home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / Python 1.1 / Doc / ref7.tex < prev    next >
LaTeX Document  |  1994-08-01  |  15.7 KB  |  [TEXT/R*ch]

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: LaTeX Document (document/latex).

You can browse this item here: ref7.tex

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file LaTeX document text default
99% file LaTeX document, ASCII text, with CR line terminators default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/281 LaTeX (Subdocument) default
100% detectItEasy Format: plain text[CR] default (weak)


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[R*ch]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 5c 63 68 61 70 74 65 72 | 7b 43 6f 6d 70 6f 75 6e |\chapter|{Compoun|
|00000010| 64 20 73 74 61 74 65 6d | 65 6e 74 73 7d 0d 5c 69 |d statem|ents}.\i|
|00000020| 6e 64 65 78 69 69 7b 63 | 6f 6d 70 6f 75 6e 64 7d |ndexii{c|ompound}|
|00000030| 7b 73 74 61 74 65 6d 65 | 6e 74 7d 0d 0d 43 6f 6d |{stateme|nt}..Com|
|00000040| 70 6f 75 6e 64 20 73 74 | 61 74 65 6d 65 6e 74 73 |pound st|atements|
|00000050| 20 63 6f 6e 74 61 69 6e | 20 28 67 72 6f 75 70 73 | contain| (groups|
|00000060| 20 6f 66 29 20 6f 74 68 | 65 72 20 73 74 61 74 65 | of) oth|er state|
|00000070| 6d 65 6e 74 73 3b 20 74 | 68 65 79 20 61 66 66 65 |ments; t|hey affe|
|00000080| 63 74 0d 6f 72 20 63 6f | 6e 74 72 6f 6c 20 74 68 |ct.or co|ntrol th|
|00000090| 65 20 65 78 65 63 75 74 | 69 6f 6e 20 6f 66 20 74 |e execut|ion of t|
|000000a0| 68 6f 73 65 20 6f 74 68 | 65 72 20 73 74 61 74 65 |hose oth|er state|
|000000b0| 6d 65 6e 74 73 20 69 6e | 20 73 6f 6d 65 20 77 61 |ments in| some wa|
|000000c0| 79 2e 20 20 49 6e 0d 67 | 65 6e 65 72 61 6c 2c 20 |y. In.g|eneral, |
|000000d0| 63 6f 6d 70 6f 75 6e 64 | 20 73 74 61 74 65 6d 65 |compound| stateme|
|000000e0| 6e 74 73 20 73 70 61 6e | 20 6d 75 6c 74 69 70 6c |nts span| multipl|
|000000f0| 65 20 6c 69 6e 65 73 2c | 20 61 6c 74 68 6f 75 67 |e lines,| althoug|
|00000100| 68 20 69 6e 20 73 69 6d | 70 6c 65 0d 69 6e 63 61 |h in sim|ple.inca|
|00000110| 72 6e 61 74 69 6f 6e 73 | 20 61 20 77 68 6f 6c 65 |rnations| a whole|
|00000120| 20 63 6f 6d 70 6f 75 6e | 64 20 73 74 61 74 65 6d | compoun|d statem|
|00000130| 65 6e 74 20 6d 61 79 20 | 62 65 20 63 6f 6e 74 61 |ent may |be conta|
|00000140| 69 6e 65 64 20 69 6e 20 | 6f 6e 65 20 6c 69 6e 65 |ined in |one line|
|00000150| 2e 0d 0d 54 68 65 20 5c | 76 65 72 62 40 69 66 40 |...The \|verb@if@|
|00000160| 2c 20 5c 76 65 72 62 40 | 77 68 69 6c 65 40 20 61 |, \verb@|while@ a|
|00000170| 6e 64 20 5c 76 65 72 62 | 40 66 6f 72 40 20 73 74 |nd \verb|@for@ st|
|00000180| 61 74 65 6d 65 6e 74 73 | 20 69 6d 70 6c 65 6d 65 |atements| impleme|
|00000190| 6e 74 0d 74 72 61 64 69 | 74 69 6f 6e 61 6c 20 63 |nt.tradi|tional c|
|000001a0| 6f 6e 74 72 6f 6c 20 66 | 6c 6f 77 20 63 6f 6e 73 |ontrol f|low cons|
|000001b0| 74 72 75 63 74 73 2e 20 | 20 5c 76 65 72 62 40 74 |tructs. | \verb@t|
|000001c0| 72 79 40 20 73 70 65 63 | 69 66 69 65 73 20 65 78 |ry@ spec|ifies ex|
|000001d0| 63 65 70 74 69 6f 6e 0d | 68 61 6e 64 6c 65 72 73 |ception.|handlers|
|000001e0| 20 61 6e 64 2f 6f 72 20 | 63 6c 65 61 6e 75 70 20 | and/or |cleanup |
|000001f0| 63 6f 64 65 20 66 6f 72 | 20 61 20 67 72 6f 75 70 |code for| a group|
|00000200| 20 6f 66 20 73 74 61 74 | 65 6d 65 6e 74 73 2e 20 | of stat|ements. |
|00000210| 20 46 75 6e 63 74 69 6f | 6e 20 61 6e 64 0d 63 6c | Functio|n and.cl|
|00000220| 61 73 73 20 64 65 66 69 | 6e 69 74 69 6f 6e 73 20 |ass defi|nitions |
|00000230| 61 72 65 20 61 6c 73 6f | 20 73 79 6e 74 61 63 74 |are also| syntact|
|00000240| 69 63 61 6c 6c 79 20 63 | 6f 6d 70 6f 75 6e 64 20 |ically c|ompound |
|00000250| 73 74 61 74 65 6d 65 6e | 74 73 2e 0d 0d 43 6f 6d |statemen|ts...Com|
|00000260| 70 6f 75 6e 64 20 73 74 | 61 74 65 6d 65 6e 74 73 |pound st|atements|
|00000270| 20 63 6f 6e 73 69 73 74 | 20 6f 66 20 6f 6e 65 20 | consist| of one |
|00000280| 6f 72 20 6d 6f 72 65 20 | 60 63 6c 61 75 73 65 73 |or more |`clauses|
|00000290| 27 2e 20 20 41 20 63 6c | 61 75 73 65 0d 63 6f 6e |'. A cl|ause.con|
|000002a0| 73 69 73 74 73 20 6f 66 | 20 61 20 68 65 61 64 65 |sists of| a heade|
|000002b0| 72 20 61 6e 64 20 61 20 | 60 73 75 69 74 65 27 2e |r and a |`suite'.|
|000002c0| 20 20 54 68 65 20 63 6c | 61 75 73 65 20 68 65 61 | The cl|ause hea|
|000002d0| 64 65 72 73 20 6f 66 20 | 61 0d 70 61 72 74 69 63 |ders of |a.partic|
|000002e0| 75 6c 61 72 20 63 6f 6d | 70 6f 75 6e 64 20 73 74 |ular com|pound st|
|000002f0| 61 74 65 6d 65 6e 74 20 | 61 72 65 20 61 6c 6c 20 |atement |are all |
|00000300| 61 74 20 74 68 65 20 73 | 61 6d 65 20 69 6e 64 65 |at the s|ame inde|
|00000310| 6e 74 61 74 69 6f 6e 20 | 6c 65 76 65 6c 2e 0d 45 |ntation |level..E|
|00000320| 61 63 68 20 63 6c 61 75 | 73 65 20 68 65 61 64 65 |ach clau|se heade|
|00000330| 72 20 62 65 67 69 6e 73 | 20 77 69 74 68 20 61 20 |r begins| with a |
|00000340| 75 6e 69 71 75 65 6c 79 | 20 69 64 65 6e 74 69 66 |uniquely| identif|
|00000350| 79 69 6e 67 20 6b 65 79 | 77 6f 72 64 20 61 6e 64 |ying key|word and|
|00000360| 20 65 6e 64 73 0d 77 69 | 74 68 20 61 20 63 6f 6c | ends.wi|th a col|
|00000370| 6f 6e 2e 20 20 41 20 73 | 75 69 74 65 20 69 73 20 |on. A s|uite is |
|00000380| 61 20 67 72 6f 75 70 20 | 6f 66 20 73 74 61 74 65 |a group |of state|
|00000390| 6d 65 6e 74 73 20 63 6f | 6e 74 72 6f 6c 6c 65 64 |ments co|ntrolled|
|000003a0| 20 62 79 20 61 0d 63 6c | 61 75 73 65 2e 20 20 41 | by a.cl|ause. A|
|000003b0| 20 73 75 69 74 65 20 63 | 61 6e 20 62 65 20 6f 6e | suite c|an be on|
|000003c0| 65 20 6f 72 20 6d 6f 72 | 65 20 73 65 6d 69 63 6f |e or mor|e semico|
|000003d0| 6c 6f 6e 2d 73 65 70 61 | 72 61 74 65 64 20 73 69 |lon-sepa|rated si|
|000003e0| 6d 70 6c 65 0d 73 74 61 | 74 65 6d 65 6e 74 73 20 |mple.sta|tements |
|000003f0| 6f 6e 20 74 68 65 20 73 | 61 6d 65 20 6c 69 6e 65 |on the s|ame line|
|00000400| 20 61 73 20 74 68 65 20 | 68 65 61 64 65 72 2c 20 | as the |header, |
|00000410| 66 6f 6c 6c 6f 77 69 6e | 67 20 74 68 65 20 68 65 |followin|g the he|
|00000420| 61 64 65 72 27 73 0d 63 | 6f 6c 6f 6e 2c 20 6f 72 |ader's.c|olon, or|
|00000430| 20 69 74 20 63 61 6e 20 | 62 65 20 6f 6e 65 20 6f | it can |be one o|
|00000440| 72 20 6d 6f 72 65 20 69 | 6e 64 65 6e 74 65 64 20 |r more i|ndented |
|00000450| 73 74 61 74 65 6d 65 6e | 74 73 20 6f 6e 20 73 75 |statemen|ts on su|
|00000460| 62 73 65 71 75 65 6e 74 | 0d 6c 69 6e 65 73 2e 20 |bsequent|.lines. |
|00000470| 20 4f 6e 6c 79 20 74 68 | 65 20 6c 61 74 74 65 72 | Only th|e latter|
|00000480| 20 66 6f 72 6d 20 6f 66 | 20 73 75 69 74 65 20 63 | form of| suite c|
|00000490| 61 6e 20 63 6f 6e 74 61 | 69 6e 20 6e 65 73 74 65 |an conta|in neste|
|000004a0| 64 20 63 6f 6d 70 6f 75 | 6e 64 0d 73 74 61 74 65 |d compou|nd.state|
|000004b0| 6d 65 6e 74 73 3b 20 74 | 68 65 20 66 6f 6c 6c 6f |ments; t|he follo|
|000004c0| 77 69 6e 67 20 69 73 20 | 69 6c 6c 65 67 61 6c 2c |wing is |illegal,|
|000004d0| 20 6d 6f 73 74 6c 79 20 | 62 65 63 61 75 73 65 20 | mostly |because |
|000004e0| 69 74 20 77 6f 75 6c 64 | 6e 27 74 20 62 65 0d 63 |it would|n't be.c|
|000004f0| 6c 65 61 72 20 74 6f 20 | 77 68 69 63 68 20 5c 76 |lear to |which \v|
|00000500| 65 72 62 40 69 66 40 20 | 63 6c 61 75 73 65 20 61 |erb@if@ |clause a|
|00000510| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 5c 76 65 72 62 | followi|ng \verb|
|00000520| 40 65 6c 73 65 40 20 63 | 6c 61 75 73 65 20 77 6f |@else@ c|lause wo|
|00000530| 75 6c 64 0d 62 65 6c 6f | 6e 67 3a 0d 5c 69 6e 64 |uld.belo|ng:.\ind|
|00000540| 65 78 7b 63 6c 61 75 73 | 65 7d 0d 5c 69 6e 64 65 |ex{claus|e}.\inde|
|00000550| 78 7b 73 75 69 74 65 7d | 0d 0d 5c 62 65 67 69 6e |x{suite}|..\begin|
|00000560| 7b 76 65 72 62 61 74 69 | 6d 7d 0d 69 66 20 74 65 |{verbati|m}.if te|
|00000570| 73 74 31 3a 20 69 66 20 | 74 65 73 74 32 3a 20 70 |st1: if |test2: p|
|00000580| 72 69 6e 74 20 78 0d 5c | 65 6e 64 7b 76 65 72 62 |rint x.\|end{verb|
|00000590| 61 74 69 6d 7d 0d 0d 41 | 6c 73 6f 20 6e 6f 74 65 |atim}..A|lso note|
|000005a0| 20 74 68 61 74 20 74 68 | 65 20 73 65 6d 69 63 6f | that th|e semico|
|000005b0| 6c 6f 6e 20 62 69 6e 64 | 73 20 74 69 67 68 74 65 |lon bind|s tighte|
|000005c0| 72 20 74 68 61 6e 20 74 | 68 65 20 63 6f 6c 6f 6e |r than t|he colon|
|000005d0| 20 69 6e 20 74 68 69 73 | 0d 63 6f 6e 74 65 78 74 | in this|.context|
|000005e0| 2c 20 73 6f 20 74 68 61 | 74 20 69 6e 20 74 68 65 |, so tha|t in the|
|000005f0| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 65 78 61 6d 70 | followi|ng examp|
|00000600| 6c 65 2c 20 65 69 74 68 | 65 72 20 61 6c 6c 20 6f |le, eith|er all o|
|00000610| 72 20 6e 6f 6e 65 20 6f | 66 20 74 68 65 0d 5c 76 |r none o|f the.\v|
|00000620| 65 72 62 40 70 72 69 6e | 74 40 20 73 74 61 74 65 |erb@prin|t@ state|
|00000630| 6d 65 6e 74 73 20 61 72 | 65 20 65 78 65 63 75 74 |ments ar|e execut|
|00000640| 65 64 3a 0d 0d 5c 62 65 | 67 69 6e 7b 76 65 72 62 |ed:..\be|gin{verb|
|00000650| 61 74 69 6d 7d 0d 69 66 | 20 78 20 3c 20 79 20 3c |atim}.if| x < y <|
|00000660| 20 7a 3a 20 70 72 69 6e | 74 20 78 3b 20 70 72 69 | z: prin|t x; pri|
|00000670| 6e 74 20 79 3b 20 70 72 | 69 6e 74 20 7a 0d 5c 65 |nt y; pr|int z.\e|
|00000680| 6e 64 7b 76 65 72 62 61 | 74 69 6d 7d 0d 0d 53 75 |nd{verba|tim}..Su|
|00000690| 6d 6d 61 72 69 7a 69 6e | 67 3a 0d 0d 5c 62 65 67 |mmarizin|g:..\beg|
|000006a0| 69 6e 7b 76 65 72 62 61 | 74 69 6d 7d 0d 63 6f 6d |in{verba|tim}.com|
|000006b0| 70 6f 75 6e 64 5f 73 74 | 6d 74 3a 20 20 69 66 5f |pound_st|mt: if_|
|000006c0| 73 74 6d 74 20 7c 20 77 | 68 69 6c 65 5f 73 74 6d |stmt | w|hile_stm|
|000006d0| 74 20 7c 20 66 6f 72 5f | 73 74 6d 74 0d 20 20 20 |t | for_|stmt. |
|000006e0| 20 20 20 20 20 20 20 20 | 20 20 20 7c 20 74 72 79 | | | try|
|000006f0| 5f 73 74 6d 74 20 7c 20 | 66 75 6e 63 64 65 66 20 |_stmt | |funcdef |
|00000700| 7c 20 63 6c 61 73 73 64 | 65 66 0d 73 75 69 74 65 || classd|ef.suite|
|00000710| 3a 20 20 20 20 20 20 20 | 20 20 20 73 74 6d 74 5f |: | stmt_|
|00000720| 6c 69 73 74 20 4e 45 57 | 4c 49 4e 45 20 7c 20 4e |list NEW|LINE | N|
|00000730| 45 57 4c 49 4e 45 20 49 | 4e 44 45 4e 54 20 73 74 |EWLINE I|NDENT st|
|00000740| 61 74 65 6d 65 6e 74 2b | 20 44 45 44 45 4e 54 0d |atement+| DEDENT.|
|00000750| 73 74 61 74 65 6d 65 6e | 74 3a 20 20 20 20 20 20 |statemen|t: |
|00000760| 73 74 6d 74 5f 6c 69 73 | 74 20 4e 45 57 4c 49 4e |stmt_lis|t NEWLIN|
|00000770| 45 20 7c 20 63 6f 6d 70 | 6f 75 6e 64 5f 73 74 6d |E | comp|ound_stm|
|00000780| 74 0d 73 74 6d 74 5f 6c | 69 73 74 3a 20 20 20 20 |t.stmt_l|ist: |
|00000790| 20 20 73 69 6d 70 6c 65 | 5f 73 74 6d 74 20 28 22 | simple|_stmt ("|
|000007a0| 3b 22 20 73 69 6d 70 6c | 65 5f 73 74 6d 74 29 2a |;" simpl|e_stmt)*|
|000007b0| 20 5b 22 3b 22 5d 0d 5c | 65 6e 64 7b 76 65 72 62 | [";"].\|end{verb|
|000007c0| 61 74 69 6d 7d 0d 0d 4e | 6f 74 65 20 74 68 61 74 |atim}..N|ote that|
|000007d0| 20 73 74 61 74 65 6d 65 | 6e 74 73 20 61 6c 77 61 | stateme|nts alwa|
|000007e0| 79 73 20 65 6e 64 20 69 | 6e 20 61 20 5c 76 65 72 |ys end i|n a \ver|
|000007f0| 62 40 4e 45 57 4c 49 4e | 45 40 20 70 6f 73 73 69 |b@NEWLIN|E@ possi|
|00000800| 62 6c 79 20 66 6f 6c 6c | 6f 77 65 64 0d 62 79 20 |bly foll|owed.by |
|00000810| 61 20 5c 76 65 72 62 40 | 44 45 44 45 4e 54 40 2e |a \verb@|DEDENT@.|
|00000820| 0d 5c 69 6e 64 65 78 7b | 4e 45 57 4c 49 4e 45 20 |.\index{|NEWLINE |
|00000830| 74 6f 6b 65 6e 7d 0d 5c | 69 6e 64 65 78 7b 44 45 |token}.\|index{DE|
|00000840| 44 45 4e 54 20 74 6f 6b | 65 6e 7d 0d 0d 41 6c 73 |DENT tok|en}..Als|
|00000850| 6f 20 6e 6f 74 65 20 74 | 68 61 74 20 6f 70 74 69 |o note t|hat opti|
|00000860| 6f 6e 61 6c 20 63 6f 6e | 74 69 6e 75 61 74 69 6f |onal con|tinuatio|
|00000870| 6e 20 63 6c 61 75 73 65 | 73 20 61 6c 77 61 79 73 |n clause|s always|
|00000880| 20 62 65 67 69 6e 20 77 | 69 74 68 20 61 0d 6b 65 | begin w|ith a.ke|
|00000890| 79 77 6f 72 64 20 74 68 | 61 74 20 63 61 6e 6e 6f |yword th|at canno|
|000008a0| 74 20 73 74 61 72 74 20 | 61 20 73 74 61 74 65 6d |t start |a statem|
|000008b0| 65 6e 74 2c 20 74 68 75 | 73 20 74 68 65 72 65 20 |ent, thu|s there |
|000008c0| 61 72 65 20 6e 6f 20 61 | 6d 62 69 67 75 69 74 69 |are no a|mbiguiti|
|000008d0| 65 73 0d 28 74 68 65 20 | 60 64 61 6e 67 6c 69 6e |es.(the |`danglin|
|000008e0| 67 20 5c 76 65 72 62 40 | 65 6c 73 65 40 27 20 70 |g \verb@|else@' p|
|000008f0| 72 6f 62 6c 65 6d 20 69 | 73 20 73 6f 6c 76 65 64 |roblem i|s solved|
|00000900| 20 69 6e 20 50 79 74 68 | 6f 6e 20 62 79 20 72 65 | in Pyth|on by re|
|00000910| 71 75 69 72 69 6e 67 0d | 6e 65 73 74 65 64 20 5c |quiring.|nested \|
|00000920| 76 65 72 62 40 69 66 40 | 20 73 74 61 74 65 6d 65 |verb@if@| stateme|
|00000930| 6e 74 73 20 74 6f 20 62 | 65 20 69 6e 64 65 6e 74 |nts to b|e indent|
|00000940| 65 64 29 2e 0d 5c 69 6e | 64 65 78 69 69 7b 64 61 |ed)..\in|dexii{da|
|00000950| 6e 67 6c 69 6e 67 7d 7b | 65 6c 73 65 7d 0d 0d 54 |ngling}{|else}..T|
|00000960| 68 65 20 66 6f 72 6d 61 | 74 74 69 6e 67 20 6f 66 |he forma|tting of|
|00000970| 20 74 68 65 20 67 72 61 | 6d 6d 61 72 20 72 75 6c | the gra|mmar rul|
|00000980| 65 73 20 69 6e 20 74 68 | 65 20 66 6f 6c 6c 6f 77 |es in th|e follow|
|00000990| 69 6e 67 20 73 65 63 74 | 69 6f 6e 73 20 70 6c 61 |ing sect|ions pla|
|000009a0| 63 65 73 0d 65 61 63 68 | 20 63 6c 61 75 73 65 20 |ces.each| clause |
|000009b0| 6f 6e 20 61 20 73 65 70 | 61 72 61 74 65 20 6c 69 |on a sep|arate li|
|000009c0| 6e 65 20 66 6f 72 20 63 | 6c 61 72 69 74 79 2e 0d |ne for c|larity..|
|000009d0| 0d 5c 73 65 63 74 69 6f | 6e 7b 54 68 65 20 7b 5c |.\sectio|n{The {\|
|000009e0| 74 74 20 69 66 7d 20 73 | 74 61 74 65 6d 65 6e 74 |tt if} s|tatement|
|000009f0| 7d 0d 5c 73 74 69 6e 64 | 65 78 7b 69 66 7d 0d 0d |}.\stind|ex{if}..|
|00000a00| 54 68 65 20 5c 76 65 72 | 62 40 69 66 40 20 73 74 |The \ver|b@if@ st|
|00000a10| 61 74 65 6d 65 6e 74 20 | 69 73 20 75 73 65 64 20 |atement |is used |
|00000a20| 66 6f 72 20 63 6f 6e 64 | 69 74 69 6f 6e 61 6c 20 |for cond|itional |
|00000a30| 65 78 65 63 75 74 69 6f | 6e 3a 0d 0d 5c 62 65 67 |executio|n:..\beg|
|00000a40| 69 6e 7b 76 65 72 62 61 | 74 69 6d 7d 0d 69 66 5f |in{verba|tim}.if_|
|00000a50| 73 74 6d 74 3a 20 20 20 | 20 20 20 20 20 22 69 66 |stmt: | "if|
|00000a60| 22 20 63 6f 6e 64 69 74 | 69 6f 6e 20 22 3a 22 20 |" condit|ion ":" |
|00000a70| 73 75 69 74 65 0d 20 20 | 20 20 20 20 20 20 20 20 |suite. | |
|00000a80| 20 20 20 20 20 28 22 65 | 6c 69 66 22 20 63 6f 6e | ("e|lif" con|
|00000a90| 64 69 74 69 6f 6e 20 22 | 3a 22 20 73 75 69 74 65 |dition "|:" suite|
|00000aa0| 29 2a 0d 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |)*. | |
|00000ab0| 20 20 5b 22 65 6c 73 65 | 22 20 22 3a 22 20 73 75 | ["else|" ":" su|
|00000ac0| 69 74 65 5d 0d 5c 65 6e | 64 7b 76 65 72 62 61 74 |ite].\en|d{verbat|
|00000ad0| 69 6d 7d 0d 0d 49 74 20 | 73 65 6c 65 63 74 73 20 |im}..It |selects |
|00000ae0| 65 78 61 63 74 6c 79 20 | 6f 6e 65 20 6f 66 20 74 |exactly |one of t|
|00000af0| 68 65 20 73 75 69 74 65 | 73 20 62 79 20 65 76 61 |he suite|s by eva|
|00000b00| 6c 75 61 74 69 6e 67 20 | 74 68 65 20 63 6f 6e 64 |luating |the cond|
|00000b10| 69 74 69 6f 6e 73 20 6f | 6e 65 0d 62 79 20 6f 6e |itions o|ne.by on|
|00000b20| 65 20 75 6e 74 69 6c 20 | 6f 6e 65 20 69 73 20 66 |e until |one is f|
|00000b30| 6f 75 6e 64 20 74 6f 20 | 62 65 20 74 72 75 65 20 |ound to |be true |
|00000b40| 28 73 65 65 20 73 65 63 | 74 69 6f 6e 20 5c 72 65 |(see sec|tion \re|
|00000b50| 66 7b 42 6f 6f 6c 65 61 | 6e 73 7d 20 66 6f 72 0d |f{Boolea|ns} for.|
|00000b60| 74 68 65 20 64 65 66 69 | 6e 69 74 69 6f 6e 20 6f |the defi|nition o|
|00000b70| 66 20 74 72 75 65 20 61 | 6e 64 20 66 61 6c 73 65 |f true a|nd false|
|00000b80| 29 3b 20 74 68 65 6e 20 | 74 68 61 74 20 73 75 69 |); then |that sui|
|00000b90| 74 65 20 69 73 20 65 78 | 65 63 75 74 65 64 20 28 |te is ex|ecuted (|
|00000ba0| 61 6e 64 20 6e 6f 0d 6f | 74 68 65 72 20 70 61 72 |and no.o|ther par|
|00000bb0| 74 20 6f 66 20 74 68 65 | 20 5c 76 65 72 62 40 69 |t of the| \verb@i|
|00000bc0| 66 40 20 73 74 61 74 65 | 6d 65 6e 74 20 69 73 20 |f@ state|ment is |
|00000bd0| 65 78 65 63 75 74 65 64 | 20 6f 72 20 65 76 61 6c |executed| or eval|
|00000be0| 75 61 74 65 64 29 2e 20 | 20 49 66 0d 61 6c 6c 20 |uated). | If.all |
|00000bf0| 63 6f 6e 64 69 74 69 6f | 6e 73 20 61 72 65 20 66 |conditio|ns are f|
|00000c00| 61 6c 73 65 2c 20 74 68 | 65 20 73 75 69 74 65 20 |alse, th|e suite |
|00000c10| 6f 66 20 74 68 65 20 5c | 76 65 72 62 40 65 6c 73 |of the \|verb@els|
|00000c20| 65 40 20 63 6c 61 75 73 | 65 2c 20 69 66 0d 70 72 |e@ claus|e, if.pr|
|00000c30| 65 73 65 6e 74 2c 20 69 | 73 20 65 78 65 63 75 74 |esent, i|s execut|
|00000c40| 65 64 2e 0d 5c 6b 77 69 | 6e 64 65 78 7b 65 6c 69 |ed..\kwi|ndex{eli|
|00000c50| 66 7d 0d 5c 6b 77 69 6e | 64 65 78 7b 65 6c 73 65 |f}.\kwin|dex{else|
|00000c60| 7d 0d 0d 5c 73 65 63 74 | 69 6f 6e 7b 54 68 65 20 |}..\sect|ion{The |
|00000c70| 7b 5c 74 74 20 77 68 69 | 6c 65 7d 20 73 74 61 74 |{\tt whi|le} stat|
|00000c80| 65 6d 65 6e 74 7d 0d 5c | 73 74 69 6e 64 65 78 7b |ement}.\|stindex{|
|00000c90| 77 68 69 6c 65 7d 0d 5c | 69 6e 64 65 78 69 69 7b |while}.\|indexii{|
|00000ca0| 6c 6f 6f 70 7d 7b 73 74 | 61 74 65 6d 65 6e 74 7d |loop}{st|atement}|
|00000cb0| 0d 0d 54 68 65 20 5c 76 | 65 72 62 40 77 68 69 6c |..The \v|erb@whil|
|00000cc0| 65 40 20 73 74 61 74 65 | 6d 65 6e 74 20 69 73 20 |e@ state|ment is |
|00000cd0| 75 73 65 64 20 66 6f 72 | 20 72 65 70 65 61 74 65 |used for| repeate|
|00000ce0| 64 20 65 78 65 63 75 74 | 69 6f 6e 20 61 73 20 6c |d execut|ion as l|
|00000cf0| 6f 6e 67 20 61 73 20 61 | 0d 63 6f 6e 64 69 74 69 |ong as a|.conditi|
|00000d00| 6f 6e 20 69 73 20 74 72 | 75 65 3a 0d 0d 5c 62 65 |on is tr|ue:..\be|
|00000d10| 67 69 6e 7b 76 65 72 62 | 61 74 69 6d 7d 0d 77 68 |gin{verb|atim}.wh|
|00000d20| 69 6c 65 5f 73 74 6d 74 | 3a 20 20 20 20 20 22 77 |ile_stmt|: "w|
|00000d30| 68 69 6c 65 22 20 63 6f | 6e 64 69 74 69 6f 6e 20 |hile" co|ndition |
|00000d40| 22 3a 22 20 73 75 69 74 | 65 0d 20 20 20 20 20 20 |":" suit|e. |
|00000d50| 20 20 20 20 20 20 20 20 | 20 5b 22 65 6c 73 65 22 | | ["else"|
|00000d60| 20 22 3a 22 20 73 75 69 | 74 65 5d 0d 5c 65 6e 64 | ":" sui|te].\end|
|00000d70| 7b 76 65 72 62 61 74 69 | 6d 7d 0d 0d 54 68 69 73 |{verbati|m}..This|
|00000d80| 20 72 65 70 65 61 74 65 | 64 6c 79 20 74 65 73 74 | repeate|dly test|
|00000d90| 73 20 74 68 65 20 63 6f | 6e 64 69 74 69 6f 6e 20 |s the co|ndition |
|00000da0| 61 6e 64 2c 20 69 66 20 | 69 74 20 69 73 20 74 72 |and, if |it is tr|
|00000db0| 75 65 2c 20 65 78 65 63 | 75 74 65 73 20 74 68 65 |ue, exec|utes the|
|00000dc0| 0d 66 69 72 73 74 20 73 | 75 69 74 65 3b 20 69 66 |.first s|uite; if|
|00000dd0| 20 74 68 65 20 63 6f 6e | 64 69 74 69 6f 6e 20 69 | the con|dition i|
|00000de0| 73 20 66 61 6c 73 65 20 | 28 77 68 69 63 68 20 6d |s false |(which m|
|00000df0| 61 79 20 62 65 20 74 68 | 65 20 66 69 72 73 74 20 |ay be th|e first |
|00000e00| 74 69 6d 65 20 69 74 0d | 69 73 20 74 65 73 74 65 |time it.|is teste|
|00000e10| 64 29 20 74 68 65 20 73 | 75 69 74 65 20 6f 66 20 |d) the s|uite of |
|00000e20| 74 68 65 20 5c 76 65 72 | 62 40 65 6c 73 65 40 20 |the \ver|b@else@ |
|00000e30| 63 6c 61 75 73 65 2c 20 | 69 66 20 70 72 65 73 65 |clause, |if prese|
|00000e40| 6e 74 2c 20 69 73 0d 65 | 78 65 63 75 74 65 64 20 |nt, is.e|xecuted |
|00000e50| 61 6e 64 20 74 68 65 20 | 6c 6f 6f 70 20 74 65 72 |and the |loop ter|
|00000e60| 6d 69 6e 61 74 65 73 2e | 0d 5c 6b 77 69 6e 64 65 |minates.|.\kwinde|
|00000e70| 78 7b 65 6c 73 65 7d 0d | 0d 41 20 5c 76 65 72 62 |x{else}.|.A \verb|
|00000e80| 40 62 72 65 61 6b 40 20 | 73 74 61 74 65 6d 65 6e |@break@ |statemen|
|00000e90| 74 20 65 78 65 63 75 74 | 65 64 20 69 6e 20 74 68 |t execut|ed in th|
|00000ea0| 65 20 66 69 72 73 74 20 | 73 75 69 74 65 20 74 65 |e first |suite te|
|00000eb0| 72 6d 69 6e 61 74 65 73 | 20 74 68 65 0d 6c 6f 6f |rminates| the.loo|
|00000ec0| 70 20 77 69 74 68 6f 75 | 74 20 65 78 65 63 75 74 |p withou|t execut|
|00000ed0| 69 6e 67 20 74 68 65 20 | 5c 76 65 72 62 40 65 6c |ing the |\verb@el|
|00000ee0| 73 65 40 20 63 6c 61 75 | 73 65 27 73 20 73 75 69 |se@ clau|se's sui|
|00000ef0| 74 65 2e 20 20 41 0d 5c | 76 65 72 62 40 63 6f 6e |te. A.\|verb@con|
|00000f00| 74 69 6e 75 65 40 20 73 | 74 61 74 65 6d 65 6e 74 |tinue@ s|tatement|
|00000f10| 20 65 78 65 63 75 74 65 | 64 20 69 6e 20 74 68 65 | execute|d in the|
|00000f20| 20 66 69 72 73 74 20 73 | 75 69 74 65 20 73 6b 69 | first s|uite ski|
|00000f30| 70 73 20 74 68 65 20 72 | 65 73 74 0d 6f 66 20 74 |ps the r|est.of t|
|00000f40| 68 65 20 73 75 69 74 65 | 20 61 6e 64 20 67 6f 65 |he suite| and goe|
|00000f50| 73 20 62 61 63 6b 20 74 | 6f 20 74 65 73 74 69 6e |s back t|o testin|
|00000f60| 67 20 74 68 65 20 63 6f | 6e 64 69 74 69 6f 6e 2e |g the co|ndition.|
|00000f70| 0d 5c 73 74 69 6e 64 65 | 78 7b 62 72 65 61 6b 7d |.\stinde|x{break}|
|00000f80| 0d 5c 73 74 69 6e 64 65 | 78 7b 63 6f 6e 74 69 6e |.\stinde|x{contin|
|00000f90| 75 65 7d 0d 0d 5c 73 65 | 63 74 69 6f 6e 7b 54 68 |ue}..\se|ction{Th|
|00000fa0| 65 20 7b 5c 74 74 20 66 | 6f 72 7d 20 73 74 61 74 |e {\tt f|or} stat|
|00000fb0| 65 6d 65 6e 74 7d 0d 5c | 73 74 69 6e 64 65 78 7b |ement}.\|stindex{|
|00000fc0| 66 6f 72 7d 0d 5c 69 6e | 64 65 78 69 69 7b 6c 6f |for}.\in|dexii{lo|
|00000fd0| 6f 70 7d 7b 73 74 61 74 | 65 6d 65 6e 74 7d 0d 0d |op}{stat|ement}..|
|00000fe0| 54 68 65 20 5c 76 65 72 | 62 40 66 6f 72 40 20 73 |The \ver|b@for@ s|
|00000ff0| 74 61 74 65 6d 65 6e 74 | 20 69 73 20 75 73 65 64 |tatement| is used|
|00001000| 20 74 6f 20 69 74 65 72 | 61 74 65 20 6f 76 65 72 | to iter|ate over|
|00001010| 20 74 68 65 20 65 6c 65 | 6d 65 6e 74 73 20 6f 66 | the ele|ments of|
|00001020| 20 61 0d 73 65 71 75 65 | 6e 63 65 20 28 73 74 72 | a.seque|nce (str|
|00001030| 69 6e 67 2c 20 74 75 70 | 6c 65 20 6f 72 20 6c 69 |ing, tup|le or li|
|00001040| 73 74 29 3a 0d 5c 6f 62 | 69 6e 64 65 78 7b 73 65 |st):.\ob|index{se|
|00001050| 71 75 65 6e 63 65 7d 0d | 0d 5c 62 65 67 69 6e 7b |quence}.|.\begin{|
|00001060| 76 65 72 62 61 74 69 6d | 7d 0d 66 6f 72 5f 73 74 |verbatim|}.for_st|
|00001070| 6d 74 3a 20 20 20 20 20 | 20 20 22 66 6f 72 22 20 |mt: | "for" |
|00001080| 74 61 72 67 65 74 5f 6c | 69 73 74 20 22 69 6e 22 |target_l|ist "in"|
|00001090| 20 63 6f 6e 64 69 74 69 | 6f 6e 5f 6c 69 73 74 20 | conditi|on_list |
|000010a0| 22 3a 22 20 73 75 69 74 | 65 0d 20 20 20 20 20 20 |":" suit|e. |
|000010b0| 20 20 20 20 20 20 20 20 | 20 5b 22 65 6c 73 65 22 | | ["else"|
|000010c0| 20 22 3a 22 20 73 75 69 | 74 65 5d 0d 5c 65 6e 64 | ":" sui|te].\end|
|000010d0| 7b 76 65 72 62 61 74 69 | 6d 7d 0d 0d 54 68 65 20 |{verbati|m}..The |
|000010e0| 63 6f 6e 64 69 74 69 6f | 6e 20 6c 69 73 74 20 69 |conditio|n list i|
|000010f0| 73 20 65 76 61 6c 75 61 | 74 65 64 20 6f 6e 63 65 |s evalua|ted once|
|00001100| 3b 20 69 74 20 73 68 6f | 75 6c 64 20 79 69 65 6c |; it sho|uld yiel|
|00001110| 64 20 61 20 73 65 71 75 | 65 6e 63 65 2e 20 20 54 |d a sequ|ence. T|
|00001120| 68 65 0d 73 75 69 74 65 | 20 69 73 20 74 68 65 6e |he.suite| is then|
|00001130| 20 65 78 65 63 75 74 65 | 64 20 6f 6e 63 65 20 66 | execute|d once f|
|00001140| 6f 72 20 65 61 63 68 20 | 69 74 65 6d 20 69 6e 20 |or each |item in |
|00001150| 74 68 65 20 73 65 71 75 | 65 6e 63 65 2c 20 69 6e |the sequ|ence, in|
|00001160| 20 74 68 65 0d 6f 72 64 | 65 72 20 6f 66 20 61 73 | the.ord|er of as|
|00001170| 63 65 6e 64 69 6e 67 20 | 69 6e 64 69 63 65 73 2e |cending |indices.|
|00001180| 20 20 45 61 63 68 20 69 | 74 65 6d 20 69 6e 20 74 | Each i|tem in t|
|00001190| 75 72 6e 20 69 73 20 61 | 73 73 69 67 6e 65 64 20 |urn is a|ssigned |
|000011a0| 74 6f 20 74 68 65 0d 74 | 61 72 67 65 74 20 6c 69 |to the.t|arget li|
|000011b0| 73 74 20 75 73 69 6e 67 | 20 74 68 65 20 73 74 61 |st using| the sta|
|000011c0| 6e 64 61 72 64 20 72 75 | 6c 65 73 20 66 6f 72 20 |ndard ru|les for |
|000011d0| 61 73 73 69 67 6e 6d 65 | 6e 74 73 2c 20 61 6e 64 |assignme|nts, and|
|000011e0| 20 74 68 65 6e 20 74 68 | 65 0d 73 75 69 74 65 20 | then th|e.suite |
|000011f0| 69 73 20 65 78 65 63 75 | 74 65 64 2e 20 20 57 68 |is execu|ted. Wh|
|00001200| 65 6e 20 74 68 65 20 69 | 74 65 6d 73 20 61 72 65 |en the i|tems are|
|00001210| 20 65 78 68 61 75 73 74 | 65 64 20 28 77 68 69 63 | exhaust|ed (whic|
|00001220| 68 20 69 73 20 69 6d 6d | 65 64 69 61 74 65 6c 79 |h is imm|ediately|
|00001230| 0d 77 68 65 6e 20 74 68 | 65 20 73 65 71 75 65 6e |.when th|e sequen|
|00001240| 63 65 20 69 73 20 65 6d | 70 74 79 29 2c 20 74 68 |ce is em|pty), th|
|00001250| 65 20 73 75 69 74 65 20 | 69 6e 20 74 68 65 20 5c |e suite |in the \|
|00001260| 76 65 72 62 40 65 6c 73 | 65 40 20 63 6c 61 75 73 |verb@els|e@ claus|
|00001270| 65 2c 20 69 66 0d 70 72 | 65 73 65 6e 74 2c 20 69 |e, if.pr|esent, i|
|00001280| 73 20 65 78 65 63 75 74 | 65 64 2c 20 61 6e 64 20 |s execut|ed, and |
|00001290| 74 68 65 20 6c 6f 6f 70 | 20 74 65 72 6d 69 6e 61 |the loop| termina|
|000012a0| 74 65 73 2e 0d 5c 6b 77 | 69 6e 64 65 78 7b 69 6e |tes..\kw|index{in|
|000012b0| 7d 0d 5c 6b 77 69 6e 64 | 65 78 7b 65 6c 73 65 7d |}.\kwind|ex{else}|
|000012c0| 0d 5c 69 6e 64 65 78 69 | 69 7b 74 61 72 67 65 74 |.\indexi|i{target|
|000012d0| 7d 7b 6c 69 73 74 7d 0d | 0d 41 20 5c 76 65 72 62 |}{list}.|.A \verb|
|000012e0| 40 62 72 65 61 6b 40 20 | 73 74 61 74 65 6d 65 6e |@break@ |statemen|
|000012f0| 74 20 65 78 65 63 75 74 | 65 64 20 69 6e 20 74 68 |t execut|ed in th|
|00001300| 65 20 66 69 72 73 74 20 | 73 75 69 74 65 20 74 65 |e first |suite te|
|00001310| 72 6d 69 6e 61 74 65 73 | 20 74 68 65 0d 6c 6f 6f |rminates| the.loo|
|00001320| 70 20 77 69 74 68 6f 75 | 74 20 65 78 65 63 75 74 |p withou|t execut|
|00001330| 69 6e 67 20 74 68 65 20 | 5c 76 65 72 62 40 65 6c |ing the |\verb@el|
|00001340| 73 65 40 20 63 6c 61 75 | 73 65 27 73 20 73 75 69 |se@ clau|se's sui|
|00001350| 74 65 2e 20 20 41 0d 5c | 76 65 72 62 40 63 6f 6e |te. A.\|verb@con|
|00001360| 74 69 6e 75 65 40 20 73 | 74 61 74 65 6d 65 6e 74 |tinue@ s|tatement|
|00001370| 20 65 78 65 63 75 74 65 | 64 20 69 6e 20 74 68 65 | execute|d in the|
|00001380| 20 66 69 72 73 74 20 73 | 75 69 74 65 20 73 6b 69 | first s|uite ski|
|00001390| 70 73 20 74 68 65 20 72 | 65 73 74 0d 6f 66 20 74 |ps the r|est.of t|
|000013a0| 68 65 20 73 75 69 74 65 | 20 61 6e 64 20 63 6f 6e |he suite| and con|
|000013b0| 74 69 6e 75 65 73 20 77 | 69 74 68 20 74 68 65 20 |tinues w|ith the |
|000013c0| 6e 65 78 74 20 69 74 65 | 6d 2c 20 6f 72 20 77 69 |next ite|m, or wi|
|000013d0| 74 68 20 74 68 65 20 5c | 76 65 72 62 40 65 6c 73 |th the \|verb@els|
|000013e0| 65 40 0d 63 6c 61 75 73 | 65 20 69 66 20 74 68 65 |e@.claus|e if the|
|000013f0| 72 65 20 77 61 73 20 6e | 6f 20 6e 65 78 74 20 69 |re was n|o next i|
|00001400| 74 65 6d 2e 0d 5c 73 74 | 69 6e 64 65 78 7b 62 72 |tem..\st|index{br|
|00001410| 65 61 6b 7d 0d 5c 73 74 | 69 6e 64 65 78 7b 63 6f |eak}.\st|index{co|
|00001420| 6e 74 69 6e 75 65 7d 0d | 0d 54 68 65 20 73 75 69 |ntinue}.|.The sui|
|00001430| 74 65 20 6d 61 79 20 61 | 73 73 69 67 6e 20 74 6f |te may a|ssign to|
|00001440| 20 74 68 65 20 76 61 72 | 69 61 62 6c 65 28 73 29 | the var|iable(s)|
|00001450| 20 69 6e 20 74 68 65 20 | 74 61 72 67 65 74 20 6c | in the |target l|
|00001460| 69 73 74 3b 20 74 68 69 | 73 20 64 6f 65 73 0d 6e |ist; thi|s does.n|
|00001470| 6f 74 20 61 66 66 65 63 | 74 20 74 68 65 20 6e 65 |ot affec|t the ne|
|00001480| 78 74 20 69 74 65 6d 20 | 61 73 73 69 67 6e 65 64 |xt item |assigned|
|00001490| 20 74 6f 20 69 74 2e 0d | 0d 54 68 65 20 74 61 72 | to it..|.The tar|
|000014a0| 67 65 74 20 6c 69 73 74 | 20 69 73 20 6e 6f 74 20 |get list| is not |
|000014b0| 64 65 6c 65 74 65 64 20 | 77 68 65 6e 20 74 68 65 |deleted |when the|
|000014c0| 20 6c 6f 6f 70 20 69 73 | 20 66 69 6e 69 73 68 65 | loop is| finishe|
|000014d0| 64 2c 20 62 75 74 20 69 | 66 20 74 68 65 0d 73 65 |d, but i|f the.se|
|000014e0| 71 75 65 6e 63 65 20 69 | 73 20 65 6d 70 74 79 2c |quence i|s empty,|
|000014f0| 20 69 74 20 77 69 6c 6c | 20 6e 6f 74 20 68 61 76 | it will| not hav|
|00001500| 65 20 62 65 65 6e 20 61 | 73 73 69 67 6e 65 64 20 |e been a|ssigned |
|00001510| 74 6f 20 61 74 20 61 6c | 6c 20 62 79 20 74 68 65 |to at al|l by the|
|00001520| 0d 6c 6f 6f 70 2e 0d 0d | 48 69 6e 74 3a 20 74 68 |.loop...|Hint: th|
|00001530| 65 20 62 75 69 6c 74 2d | 69 6e 20 66 75 6e 63 74 |e built-|in funct|
|00001540| 69 6f 6e 20 5c 76 65 72 | 62 40 72 61 6e 67 65 28 |ion \ver|b@range(|
|00001550| 29 40 20 72 65 74 75 72 | 6e 73 20 61 20 73 65 71 |)@ retur|ns a seq|
|00001560| 75 65 6e 63 65 20 6f 66 | 0d 69 6e 74 65 67 65 72 |uence of|.integer|
|00001570| 73 20 73 75 69 74 61 62 | 6c 65 20 74 6f 20 65 6d |s suitab|le to em|
|00001580| 75 6c 61 74 65 20 74 68 | 65 20 65 66 66 65 63 74 |ulate th|e effect|
|00001590| 20 6f 66 20 50 61 73 63 | 61 6c 27 73 0d 5c 76 65 | of Pasc|al's.\ve|
|000015a0| 72 62 40 66 6f 72 20 69 | 20 3a 3d 20 61 20 74 6f |rb@for i| := a to|
|000015b0| 20 62 20 64 6f 40 3b 0d | 65 2e 67 2e 20 5c 76 65 | b do@;.|e.g. \ve|
|000015c0| 72 62 40 72 61 6e 67 65 | 28 33 29 40 20 72 65 74 |rb@range|(3)@ ret|
|000015d0| 75 72 6e 73 20 74 68 65 | 20 6c 69 73 74 20 5c 76 |urns the| list \v|
|000015e0| 65 72 62 40 5b 30 2c 20 | 31 2c 20 32 5d 40 2e 0d |erb@[0, |1, 2]@..|
|000015f0| 5c 62 69 66 75 6e 63 69 | 6e 64 65 78 7b 72 61 6e |\bifunci|ndex{ran|
|00001600| 67 65 7d 0d 5c 69 6e 64 | 65 78 7b 50 61 73 63 61 |ge}.\ind|ex{Pasca|
|00001610| 6c 7d 0d 0d 7b 5c 62 66 | 20 57 61 72 6e 69 6e 67 |l}..{\bf| Warning|
|00001620| 3a 7d 20 54 68 65 72 65 | 20 69 73 20 61 20 73 75 |:} There| is a su|
|00001630| 62 74 6c 65 74 79 20 77 | 68 65 6e 20 74 68 65 20 |btlety w|hen the |
|00001640| 73 65 71 75 65 6e 63 65 | 20 69 73 20 62 65 69 6e |sequence| is bein|
|00001650| 67 20 6d 6f 64 69 66 69 | 65 64 0d 62 79 20 74 68 |g modifi|ed.by th|
|00001660| 65 20 6c 6f 6f 70 20 28 | 74 68 69 73 20 63 61 6e |e loop (|this can|
|00001670| 20 6f 6e 6c 79 20 6f 63 | 63 75 72 20 66 6f 72 20 | only oc|cur for |
|00001680| 6d 75 74 61 62 6c 65 20 | 73 65 71 75 65 6e 63 65 |mutable |sequence|
|00001690| 73 2c 20 69 2e 65 2e 20 | 6c 69 73 74 73 29 2e 0d |s, i.e. |lists)..|
|000016a0| 41 6e 20 69 6e 74 65 72 | 6e 61 6c 20 63 6f 75 6e |An inter|nal coun|
|000016b0| 74 65 72 20 69 73 20 75 | 73 65 64 20 74 6f 20 6b |ter is u|sed to k|
|000016c0| 65 65 70 20 74 72 61 63 | 6b 20 6f 66 20 77 68 69 |eep trac|k of whi|
|000016d0| 63 68 20 69 74 65 6d 20 | 69 73 20 75 73 65 64 20 |ch item |is used |
|000016e0| 6e 65 78 74 2c 0d 61 6e | 64 20 74 68 69 73 20 69 |next,.an|d this i|
|000016f0| 73 20 69 6e 63 72 65 6d | 65 6e 74 65 64 20 6f 6e |s increm|ented on|
|00001700| 20 65 61 63 68 20 69 74 | 65 72 61 74 69 6f 6e 2e | each it|eration.|
|00001710| 20 20 57 68 65 6e 20 74 | 68 69 73 20 63 6f 75 6e | When t|his coun|
|00001720| 74 65 72 20 68 61 73 0d | 72 65 61 63 68 65 64 20 |ter has.|reached |
|00001730| 74 68 65 20 6c 65 6e 67 | 74 68 20 6f 66 20 74 68 |the leng|th of th|
|00001740| 65 20 73 65 71 75 65 6e | 63 65 20 74 68 65 20 6c |e sequen|ce the l|
|00001750| 6f 6f 70 20 74 65 72 6d | 69 6e 61 74 65 73 2e 20 |oop term|inates. |
|00001760| 20 54 68 69 73 20 6d 65 | 61 6e 73 20 74 68 61 74 | This me|ans that|
|00001770| 0d 69 66 20 74 68 65 20 | 73 75 69 74 65 20 64 65 |.if the |suite de|
|00001780| 6c 65 74 65 73 20 74 68 | 65 20 63 75 72 72 65 6e |letes th|e curren|
|00001790| 74 20 28 6f 72 20 61 20 | 70 72 65 76 69 6f 75 73 |t (or a |previous|
|000017a0| 29 20 69 74 65 6d 20 66 | 72 6f 6d 20 74 68 65 0d |) item f|rom the.|
|000017b0| 73 65 71 75 65 6e 63 65 | 2c 20 74 68 65 20 6e 65 |sequence|, the ne|
|000017c0| 78 74 20 69 74 65 6d 20 | 77 69 6c 6c 20 62 65 20 |xt item |will be |
|000017d0| 73 6b 69 70 70 65 64 20 | 28 73 69 6e 63 65 20 69 |skipped |(since i|
|000017e0| 74 20 67 65 74 73 20 74 | 68 65 20 69 6e 64 65 78 |t gets t|he index|
|000017f0| 20 6f 66 0d 74 68 65 20 | 63 75 72 72 65 6e 74 20 | of.the |current |
|00001800| 69 74 65 6d 20 77 68 69 | 63 68 20 68 61 73 20 61 |item whi|ch has a|
|00001810| 6c 72 65 61 64 79 20 62 | 65 65 6e 20 74 72 65 61 |lready b|een trea|
|00001820| 74 65 64 29 2e 20 20 4c | 69 6b 65 77 69 73 65 2c |ted). L|ikewise,|
|00001830| 20 69 66 20 74 68 65 0d | 73 75 69 74 65 20 69 6e | if the.|suite in|
|00001840| 73 65 72 74 73 20 61 6e | 20 69 74 65 6d 20 69 6e |serts an| item in|
|00001850| 20 74 68 65 20 73 65 71 | 75 65 6e 63 65 20 62 65 | the seq|uence be|
|00001860| 66 6f 72 65 20 74 68 65 | 20 63 75 72 72 65 6e 74 |fore the| current|
|00001870| 20 69 74 65 6d 2c 20 74 | 68 65 0d 63 75 72 72 65 | item, t|he.curre|
|00001880| 6e 74 20 69 74 65 6d 20 | 77 69 6c 6c 20 62 65 20 |nt item |will be |
|00001890| 74 72 65 61 74 65 64 20 | 61 67 61 69 6e 20 74 68 |treated |again th|
|000018a0| 65 20 6e 65 78 74 20 74 | 69 6d 65 20 74 68 72 6f |e next t|ime thro|
|000018b0| 75 67 68 20 74 68 65 20 | 6c 6f 6f 70 2e 0d 54 68 |ugh the |loop..Th|
|000018c0| 69 73 20 63 61 6e 20 6c | 65 61 64 20 74 6f 20 6e |is can l|ead to n|
|000018d0| 61 73 74 79 20 62 75 67 | 73 20 74 68 61 74 20 63 |asty bug|s that c|
|000018e0| 61 6e 20 62 65 20 61 76 | 6f 69 64 65 64 20 62 79 |an be av|oided by|
|000018f0| 20 6d 61 6b 69 6e 67 20 | 61 20 74 65 6d 70 6f 72 | making |a tempor|
|00001900| 61 72 79 0d 63 6f 70 79 | 20 75 73 69 6e 67 20 61 |ary.copy| using a|
|00001910| 20 73 6c 69 63 65 20 6f | 66 20 74 68 65 20 77 68 | slice o|f the wh|
|00001920| 6f 6c 65 20 73 65 71 75 | 65 6e 63 65 2c 20 65 2e |ole sequ|ence, e.|
|00001930| 67 2e 0d 5c 69 6e 64 65 | 78 7b 6c 6f 6f 70 21 6f |g..\inde|x{loop!o|
|00001940| 76 65 72 20 6d 75 74 61 | 62 6c 65 20 73 65 71 75 |ver muta|ble sequ|
|00001950| 65 6e 63 65 7d 0d 5c 69 | 6e 64 65 78 7b 6d 75 74 |ence}.\i|ndex{mut|
|00001960| 61 62 6c 65 20 73 65 71 | 75 65 6e 63 65 21 6c 6f |able seq|uence!lo|
|00001970| 6f 70 20 6f 76 65 72 7d | 0d 0d 5c 62 65 67 69 6e |op over}|..\begin|
|00001980| 7b 76 65 72 62 61 74 69 | 6d 7d 0d 66 6f 72 20 78 |{verbati|m}.for x|
|00001990| 20 69 6e 20 61 5b 3a 5d | 3a 0d 20 20 20 20 69 66 | in a[:]|:. if|
|000019a0| 20 78 20 3c 20 30 3a 20 | 61 2e 72 65 6d 6f 76 65 | x < 0: |a.remove|
|000019b0| 28 78 29 0d 5c 65 6e 64 | 7b 76 65 72 62 61 74 69 |(x).\end|{verbati|
|000019c0| 6d 7d 0d 0d 5c 73 65 63 | 74 69 6f 6e 7b 54 68 65 |m}..\sec|tion{The|
|000019d0| 20 7b 5c 74 74 20 74 72 | 79 7d 20 73 74 61 74 65 | {\tt tr|y} state|
|000019e0| 6d 65 6e 74 7d 20 5c 6c | 61 62 65 6c 7b 74 72 79 |ment} \l|abel{try|
|000019f0| 7d 0d 5c 73 74 69 6e 64 | 65 78 7b 74 72 79 7d 0d |}.\stind|ex{try}.|
|00001a00| 0d 54 68 65 20 5c 76 65 | 72 62 40 74 72 79 40 20 |.The \ve|rb@try@ |
|00001a10| 73 74 61 74 65 6d 65 6e | 74 20 73 70 65 63 69 66 |statemen|t specif|
|00001a20| 69 65 73 20 65 78 63 65 | 70 74 69 6f 6e 20 68 61 |ies exce|ption ha|
|00001a30| 6e 64 6c 65 72 73 20 61 | 6e 64 2f 6f 72 20 63 6c |ndlers a|nd/or cl|
|00001a40| 65 61 6e 75 70 0d 63 6f | 64 65 20 66 6f 72 20 61 |eanup.co|de for a|
|00001a50| 20 67 72 6f 75 70 20 6f | 66 20 73 74 61 74 65 6d | group o|f statem|
|00001a60| 65 6e 74 73 3a 0d 0d 5c | 62 65 67 69 6e 7b 76 65 |ents:..\|begin{ve|
|00001a70| 72 62 61 74 69 6d 7d 0d | 74 72 79 5f 73 74 6d 74 |rbatim}.|try_stmt|
|00001a80| 3a 20 20 20 20 20 20 20 | 74 72 79 5f 65 78 63 5f |: |try_exc_|
|00001a90| 73 74 6d 74 20 7c 20 74 | 72 79 5f 66 69 6e 5f 73 |stmt | t|ry_fin_s|
|00001aa0| 74 6d 74 0d 74 72 79 5f | 65 78 63 5f 73 74 6d 74 |tmt.try_|exc_stmt|
|00001ab0| 3a 20 20 20 22 74 72 79 | 22 20 22 3a 22 20 73 75 |: "try|" ":" su|
|00001ac0| 69 74 65 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |ite. | |
|00001ad0| 20 20 20 28 22 65 78 63 | 65 70 74 22 20 5b 63 6f | ("exc|ept" [co|
|00001ae0| 6e 64 69 74 69 6f 6e 20 | 5b 22 2c 22 20 74 61 72 |ndition |["," tar|
|00001af0| 67 65 74 5d 5d 20 22 3a | 22 20 73 75 69 74 65 29 |get]] ":|" suite)|
|00001b00| 2b 0d 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |+. | |
|00001b10| 20 5b 22 65 6c 73 65 22 | 20 22 3a 22 20 73 75 69 | ["else"| ":" sui|
|00001b20| 74 65 5d 0d 74 72 79 5f | 66 69 6e 5f 73 74 6d 74 |te].try_|fin_stmt|
|00001b30| 3a 20 20 20 22 74 72 79 | 22 20 22 3a 22 20 73 75 |: "try|" ":" su|
|00001b40| 69 74 65 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |ite. | |
|00001b50| 20 20 20 22 66 69 6e 61 | 6c 6c 79 22 20 22 3a 22 | "fina|lly" ":"|
|00001b60| 20 73 75 69 74 65 0d 5c | 65 6e 64 7b 76 65 72 62 | suite.\|end{verb|
|00001b70| 61 74 69 6d 7d 0d 0d 54 | 68 65 72 65 20 61 72 65 |atim}..T|here are|
|00001b80| 20 74 77 6f 20 66 6f 72 | 6d 73 20 6f 66 20 5c 76 | two for|ms of \v|
|00001b90| 65 72 62 40 74 72 79 40 | 20 73 74 61 74 65 6d 65 |erb@try@| stateme|
|00001ba0| 6e 74 3a 20 5c 76 65 72 | 62 40 74 72 79 2e 2e 2e |nt: \ver|b@try...|
|00001bb0| 65 78 63 65 70 74 40 20 | 61 6e 64 0d 5c 76 65 72 |except@ |and.\ver|
|00001bc0| 62 40 74 72 79 2e 2e 2e | 66 69 6e 61 6c 6c 79 40 |b@try...|finally@|
|00001bd0| 2e 20 20 54 68 65 73 65 | 20 66 6f 72 6d 73 20 63 |. These| forms c|
|00001be0| 61 6e 6e 6f 74 20 62 65 | 20 6d 69 78 65 64 2e 0d |annot be| mixed..|
|00001bf0| 0d 54 68 65 20 5c 76 65 | 72 62 40 74 72 79 2e 2e |.The \ve|rb@try..|
|00001c00| 2e 65 78 63 65 70 74 40 | 20 66 6f 72 6d 20 73 70 |.except@| form sp|
|00001c10| 65 63 69 66 69 65 73 20 | 6f 6e 65 20 6f 72 20 6d |ecifies |one or m|
|00001c20| 6f 72 65 20 65 78 63 65 | 70 74 69 6f 6e 20 68 61 |ore exce|ption ha|
|00001c30| 6e 64 6c 65 72 73 0d 28 | 74 68 65 20 5c 76 65 72 |ndlers.(|the \ver|
|00001c40| 62 40 65 78 63 65 70 74 | 40 20 63 6c 61 75 73 65 |b@except|@ clause|
|00001c50| 73 29 2e 20 20 57 68 65 | 6e 20 6e 6f 20 65 78 63 |s). Whe|n no exc|
|00001c60| 65 70 74 69 6f 6e 20 6f | 63 63 75 72 73 20 69 6e |eption o|ccurs in|
|00001c70| 20 74 68 65 0d 5c 76 65 | 72 62 40 74 72 79 40 20 | the.\ve|rb@try@ |
|00001c80| 63 6c 61 75 73 65 2c 20 | 6e 6f 20 65 78 63 65 70 |clause, |no excep|
|00001c90| 74 69 6f 6e 20 68 61 6e | 64 6c 65 72 20 69 73 20 |tion han|dler is |
|00001ca0| 65 78 65 63 75 74 65 64 | 2e 20 20 57 68 65 6e 20 |executed|. When |
|00001cb0| 61 6e 0d 65 78 63 65 70 | 74 69 6f 6e 20 6f 63 63 |an.excep|tion occ|
|00001cc0| 75 72 73 20 69 6e 20 74 | 68 65 20 5c 76 65 72 62 |urs in t|he \verb|
|00001cd0| 40 74 72 79 40 20 73 75 | 69 74 65 2c 20 61 20 73 |@try@ su|ite, a s|
|00001ce0| 65 61 72 63 68 20 66 6f | 72 20 61 6e 20 65 78 63 |earch fo|r an exc|
|00001cf0| 65 70 74 69 6f 6e 0d 68 | 61 6e 64 6c 65 72 20 69 |eption.h|andler i|
|00001d00| 73 20 73 74 61 72 74 65 | 64 2e 20 20 54 68 69 73 |s starte|d. This|
|00001d10| 20 69 6e 73 70 65 63 74 | 73 20 74 68 65 20 65 78 | inspect|s the ex|
|00001d20| 63 65 70 74 20 63 6c 61 | 75 73 65 73 20 69 6e 20 |cept cla|uses in |
|00001d30| 74 75 72 6e 20 75 6e 74 | 69 6c 0d 6f 6e 65 20 69 |turn unt|il.one i|
|00001d40| 73 20 66 6f 75 6e 64 20 | 74 68 61 74 20 6d 61 74 |s found |that mat|
|00001d50| 63 68 65 73 20 74 68 65 | 20 65 78 63 65 70 74 69 |ches the| excepti|
|00001d60| 6f 6e 2e 20 20 41 20 63 | 6f 6e 64 69 74 69 6f 6e |on. A c|ondition|
|00001d70| 2d 6c 65 73 73 20 65 78 | 63 65 70 74 0d 63 6c 61 |-less ex|cept.cla|
|00001d80| 75 73 65 2c 20 69 66 20 | 70 72 65 73 65 6e 74 2c |use, if |present,|
|00001d90| 20 6d 75 73 74 20 62 65 | 20 6c 61 73 74 3b 20 69 | must be| last; i|
|00001da0| 74 20 6d 61 74 63 68 65 | 73 20 61 6e 79 20 65 78 |t matche|s any ex|
|00001db0| 63 65 70 74 69 6f 6e 2e | 20 20 46 6f 72 20 61 6e |ception.| For an|
|00001dc0| 0d 65 78 63 65 70 74 20 | 63 6c 61 75 73 65 20 77 |.except |clause w|
|00001dd0| 69 74 68 20 61 20 63 6f | 6e 64 69 74 69 6f 6e 2c |ith a co|ndition,|
|00001de0| 20 74 68 61 74 20 63 6f | 6e 64 69 74 69 6f 6e 20 | that co|ndition |
|00001df0| 69 73 20 65 76 61 6c 75 | 61 74 65 64 2c 20 61 6e |is evalu|ated, an|
|00001e00| 64 20 74 68 65 0d 63 6c | 61 75 73 65 20 6d 61 74 |d the.cl|ause mat|
|00001e10| 63 68 65 73 20 74 68 65 | 20 65 78 63 65 70 74 69 |ches the| excepti|
|00001e20| 6f 6e 20 69 66 20 74 68 | 65 20 72 65 73 75 6c 74 |on if th|e result|
|00001e30| 69 6e 67 20 6f 62 6a 65 | 63 74 20 69 73 20 60 60 |ing obje|ct is ``|
|00001e40| 63 6f 6d 70 61 74 69 62 | 6c 65 27 27 0d 77 69 74 |compatib|le''.wit|
|00001e50| 68 20 74 68 65 20 65 78 | 63 65 70 74 69 6f 6e 2e |h the ex|ception.|
|00001e60| 20 20 41 6e 20 6f 62 6a | 65 63 74 20 69 73 20 63 | An obj|ect is c|
|00001e70| 6f 6d 70 61 74 69 62 6c | 65 20 77 69 74 68 20 61 |ompatibl|e with a|
|00001e80| 6e 20 65 78 63 65 70 74 | 69 6f 6e 20 69 66 20 69 |n except|ion if i|
|00001e90| 74 0d 69 73 20 65 69 74 | 68 65 72 20 74 68 65 20 |t.is eit|her the |
|00001ea0| 6f 62 6a 65 63 74 20 74 | 68 61 74 20 69 64 65 6e |object t|hat iden|
|00001eb0| 74 69 66 69 65 73 20 74 | 68 65 20 65 78 63 65 70 |tifies t|he excep|
|00001ec0| 74 69 6f 6e 20 6f 72 20 | 69 74 20 69 73 20 61 20 |tion or |it is a |
|00001ed0| 74 75 70 6c 65 0d 63 6f | 6e 74 61 69 6e 69 6e 67 |tuple.co|ntaining|
|00001ee0| 20 61 6e 20 69 74 65 6d | 20 74 68 61 74 20 69 73 | an item| that is|
|00001ef0| 20 63 6f 6d 70 61 74 69 | 62 6c 65 20 77 69 74 68 | compati|ble with|
|00001f00| 20 74 68 65 20 65 78 63 | 65 70 74 69 6f 6e 2e 20 | the exc|eption. |
|00001f10| 20 4e 6f 74 65 20 74 68 | 61 74 0d 74 68 65 20 6f | Note th|at.the o|
|00001f20| 62 6a 65 63 74 20 69 64 | 65 6e 74 69 74 69 65 73 |bject id|entities|
|00001f30| 20 6d 75 73 74 20 6d 61 | 74 63 68 2c 20 69 2e 65 | must ma|tch, i.e|
|00001f40| 2e 20 69 74 20 6d 75 73 | 74 20 62 65 20 74 68 65 |. it mus|t be the|
|00001f50| 20 73 61 6d 65 20 6f 62 | 6a 65 63 74 2c 20 6e 6f | same ob|ject, no|
|00001f60| 74 0d 6a 75 73 74 20 61 | 6e 20 6f 62 6a 65 63 74 |t.just a|n object|
|00001f70| 20 77 69 74 68 20 74 68 | 65 20 73 61 6d 65 20 76 | with th|e same v|
|00001f80| 61 6c 75 65 2e 0d 5c 6b | 77 69 6e 64 65 78 7b 65 |alue..\k|windex{e|
|00001f90| 78 63 65 70 74 7d 0d 0d | 49 66 20 6e 6f 20 65 78 |xcept}..|If no ex|
|00001fa0| 63 65 70 74 20 63 6c 61 | 75 73 65 20 6d 61 74 63 |cept cla|use matc|
|00001fb0| 68 65 73 20 74 68 65 20 | 65 78 63 65 70 74 69 6f |hes the |exceptio|
|00001fc0| 6e 2c 20 74 68 65 20 73 | 65 61 72 63 68 20 66 6f |n, the s|earch fo|
|00001fd0| 72 20 61 6e 20 65 78 63 | 65 70 74 69 6f 6e 0d 68 |r an exc|eption.h|
|00001fe0| 61 6e 64 6c 65 72 20 63 | 6f 6e 74 69 6e 75 65 73 |andler c|ontinues|
|00001ff0| 20 69 6e 20 74 68 65 20 | 73 75 72 72 6f 75 6e 64 | in the |surround|
|00002000| 69 6e 67 20 63 6f 64 65 | 20 61 6e 64 20 6f 6e 20 |ing code| and on |
|00002010| 74 68 65 20 69 6e 76 6f | 63 61 74 69 6f 6e 20 73 |the invo|cation s|
|00002020| 74 61 63 6b 2e 0d 0d 49 | 66 20 74 68 65 20 65 76 |tack...I|f the ev|
|00002030| 61 6c 75 61 74 69 6f 6e | 20 6f 66 20 61 20 63 6f |aluation| of a co|
|00002040| 6e 64 69 74 69 6f 6e 20 | 69 6e 20 74 68 65 20 68 |ndition |in the h|
|00002050| 65 61 64 65 72 20 6f 66 | 20 61 6e 20 65 78 63 65 |eader of| an exce|
|00002060| 70 74 20 63 6c 61 75 73 | 65 0d 72 61 69 73 65 73 |pt claus|e.raises|
|00002070| 20 61 6e 20 65 78 63 65 | 70 74 69 6f 6e 2c 20 74 | an exce|ption, t|
|00002080| 68 65 20 6f 72 69 67 69 | 6e 61 6c 20 73 65 61 72 |he origi|nal sear|
|00002090| 63 68 20 66 6f 72 20 61 | 20 68 61 6e 64 6c 65 72 |ch for a| handler|
|000020a0| 20 69 73 20 63 61 6e 63 | 65 6c 6c 65 64 0d 61 6e | is canc|elled.an|
|000020b0| 64 20 61 20 73 65 61 72 | 63 68 20 73 74 61 72 74 |d a sear|ch start|
|000020c0| 73 20 66 6f 72 20 74 68 | 65 20 6e 65 77 20 65 78 |s for th|e new ex|
|000020d0| 63 65 70 74 69 6f 6e 20 | 69 6e 20 74 68 65 20 73 |ception |in the s|
|000020e0| 75 72 72 6f 75 6e 64 69 | 6e 67 20 63 6f 64 65 20 |urroundi|ng code |
|000020f0| 61 6e 64 0d 6f 6e 20 74 | 68 65 20 63 61 6c 6c 20 |and.on t|he call |
|00002100| 73 74 61 63 6b 20 28 69 | 74 20 69 73 20 74 72 65 |stack (i|t is tre|
|00002110| 61 74 65 64 20 61 73 20 | 69 66 20 74 68 65 20 65 |ated as |if the e|
|00002120| 6e 74 69 72 65 20 5c 76 | 65 72 62 40 74 72 79 40 |ntire \v|erb@try@|
|00002130| 20 73 74 61 74 65 6d 65 | 6e 74 0d 72 61 69 73 65 | stateme|nt.raise|
|00002140| 64 20 74 68 65 20 65 78 | 63 65 70 74 69 6f 6e 29 |d the ex|ception)|
|00002150| 2e 0d 0d 57 68 65 6e 20 | 61 20 6d 61 74 63 68 69 |...When |a matchi|
|00002160| 6e 67 20 65 78 63 65 70 | 74 20 63 6c 61 75 73 65 |ng excep|t clause|
|00002170| 20 69 73 20 66 6f 75 6e | 64 2c 20 74 68 65 20 65 | is foun|d, the e|
|00002180| 78 63 65 70 74 69 6f 6e | 27 73 20 70 61 72 61 6d |xception|'s param|
|00002190| 65 74 65 72 20 69 73 0d | 61 73 73 69 67 6e 65 64 |eter is.|assigned|
|000021a0| 20 74 6f 20 74 68 65 20 | 74 61 72 67 65 74 20 73 | to the |target s|
|000021b0| 70 65 63 69 66 69 65 64 | 20 69 6e 20 74 68 61 74 |pecified| in that|
|000021c0| 20 65 78 63 65 70 74 20 | 63 6c 61 75 73 65 2c 20 | except |clause, |
|000021d0| 69 66 20 70 72 65 73 65 | 6e 74 2c 0d 61 6e 64 20 |if prese|nt,.and |
|000021e0| 74 68 65 20 65 78 63 65 | 70 74 20 63 6c 61 75 73 |the exce|pt claus|
|000021f0| 65 27 73 20 73 75 69 74 | 65 20 69 73 20 65 78 65 |e's suit|e is exe|
|00002200| 63 75 74 65 64 2e 20 20 | 57 68 65 6e 20 74 68 65 |cuted. |When the|
|00002210| 20 65 6e 64 20 6f 66 20 | 74 68 69 73 20 73 75 69 | end of |this sui|
|00002220| 74 65 0d 69 73 20 72 65 | 61 63 68 65 64 2c 20 65 |te.is re|ached, e|
|00002230| 78 65 63 75 74 69 6f 6e | 20 63 6f 6e 74 69 6e 75 |xecution| continu|
|00002240| 65 73 20 6e 6f 72 6d 61 | 6c 6c 79 20 61 66 74 65 |es norma|lly afte|
|00002250| 72 20 74 68 65 20 65 6e | 74 69 72 65 20 74 72 79 |r the en|tire try|
|00002260| 0d 73 74 61 74 65 6d 65 | 6e 74 2e 20 20 28 54 68 |.stateme|nt. (Th|
|00002270| 69 73 20 6d 65 61 6e 73 | 20 74 68 61 74 20 69 66 |is means| that if|
|00002280| 20 74 77 6f 20 6e 65 73 | 74 65 64 20 68 61 6e 64 | two nes|ted hand|
|00002290| 6c 65 72 73 20 65 78 69 | 73 74 20 66 6f 72 20 74 |lers exi|st for t|
|000022a0| 68 65 20 73 61 6d 65 0d | 65 78 63 65 70 74 69 6f |he same.|exceptio|
|000022b0| 6e 2c 20 61 6e 64 20 74 | 68 65 20 65 78 63 65 70 |n, and t|he excep|
|000022c0| 74 69 6f 6e 20 6f 63 63 | 75 72 73 20 69 6e 20 74 |tion occ|urs in t|
|000022d0| 68 65 20 74 72 79 20 63 | 6c 61 75 73 65 20 6f 66 |he try c|lause of|
|000022e0| 20 74 68 65 20 69 6e 6e | 65 72 0d 68 61 6e 64 6c | the inn|er.handl|
|000022f0| 65 72 2c 20 74 68 65 20 | 6f 75 74 65 72 20 68 61 |er, the |outer ha|
|00002300| 6e 64 6c 65 72 20 77 69 | 6c 6c 20 6e 6f 74 20 68 |ndler wi|ll not h|
|00002310| 61 6e 64 6c 65 20 74 68 | 65 20 65 78 63 65 70 74 |andle th|e except|
|00002320| 69 6f 6e 2e 29 0d 0d 42 | 65 66 6f 72 65 20 61 6e |ion.)..B|efore an|
|00002330| 20 65 78 63 65 70 74 20 | 63 6c 61 75 73 65 27 73 | except |clause's|
|00002340| 20 73 75 69 74 65 20 69 | 73 20 65 78 65 63 75 74 | suite i|s execut|
|00002350| 65 64 2c 20 64 65 74 61 | 69 6c 73 20 61 62 6f 75 |ed, deta|ils abou|
|00002360| 74 20 74 68 65 0d 65 78 | 63 65 70 74 69 6f 6e 20 |t the.ex|ception |
|00002370| 61 72 65 20 61 73 73 69 | 67 6e 65 64 20 74 6f 20 |are assi|gned to |
|00002380| 74 68 72 65 65 20 76 61 | 72 69 61 62 6c 65 73 20 |three va|riables |
|00002390| 69 6e 20 74 68 65 20 5c | 76 65 72 62 40 73 79 73 |in the \|verb@sys|
|000023a0| 40 20 6d 6f 64 75 6c 65 | 3a 0d 5c 76 65 72 62 40 |@ module|:.\verb@|
|000023b0| 73 79 73 2e 65 78 63 5f | 74 79 70 65 40 20 72 65 |sys.exc_|type@ re|
|000023c0| 63 65 69 76 65 73 20 74 | 68 65 20 6f 62 6a 65 63 |ceives t|he objec|
|000023d0| 74 20 69 64 65 6e 74 69 | 66 79 69 6e 67 20 74 68 |t identi|fying th|
|000023e0| 65 20 65 78 63 65 70 74 | 69 6f 6e 3b 0d 5c 76 65 |e except|ion;.\ve|
|000023f0| 72 62 40 73 79 73 2e 65 | 78 63 5f 76 61 6c 75 65 |rb@sys.e|xc_value|
|00002400| 40 20 72 65 63 65 69 76 | 65 73 20 74 68 65 20 65 |@ receiv|es the e|
|00002410| 78 63 65 70 74 69 6f 6e | 27 73 20 70 61 72 61 6d |xception|'s param|
|00002420| 65 74 65 72 3b 0d 5c 76 | 65 72 62 40 73 79 73 2e |eter;.\v|erb@sys.|
|00002430| 65 78 63 5f 74 72 61 63 | 65 62 61 63 6b 40 20 72 |exc_trac|eback@ r|
|00002440| 65 63 65 69 76 65 73 20 | 61 20 74 72 61 63 65 62 |eceives |a traceb|
|00002450| 61 63 6b 20 6f 62 6a 65 | 63 74 20 28 73 65 65 20 |ack obje|ct (see |
|00002460| 73 65 63 74 69 6f 6e 0d | 5c 72 65 66 7b 74 72 61 |section.|\ref{tra|
|00002470| 63 65 62 61 63 6b 7d 29 | 20 69 64 65 6e 74 69 66 |ceback})| identif|
|00002480| 79 69 6e 67 20 74 68 65 | 20 70 6f 69 6e 74 20 69 |ying the| point i|
|00002490| 6e 20 74 68 65 20 70 72 | 6f 67 72 61 6d 20 77 68 |n the pr|ogram wh|
|000024a0| 65 72 65 20 74 68 65 0d | 65 78 63 65 70 74 69 6f |ere the.|exceptio|
|000024b0| 6e 20 6f 63 63 75 72 72 | 65 64 2e 0d 5c 62 69 6d |n occurr|ed..\bim|
|000024c0| 6f 64 69 6e 64 65 78 7b | 73 79 73 7d 0d 5c 74 74 |odindex{|sys}.\tt|
|000024d0| 69 6e 64 65 78 7b 65 78 | 63 5f 74 79 70 65 7d 0d |index{ex|c_type}.|
|000024e0| 5c 74 74 69 6e 64 65 78 | 7b 65 78 63 5f 76 61 6c |\ttindex|{exc_val|
|000024f0| 75 65 7d 0d 5c 74 74 69 | 6e 64 65 78 7b 65 78 63 |ue}.\tti|ndex{exc|
|00002500| 5f 74 72 61 63 65 62 61 | 63 6b 7d 0d 5c 6f 62 69 |_traceba|ck}.\obi|
|00002510| 6e 64 65 78 7b 74 72 61 | 63 65 62 61 63 6b 7d 0d |ndex{tra|ceback}.|
|00002520| 0d 54 68 65 20 6f 70 74 | 69 6f 6e 61 6c 20 5c 76 |.The opt|ional \v|
|00002530| 65 72 62 40 65 6c 73 65 | 40 20 63 6c 61 75 73 65 |erb@else|@ clause|
|00002540| 20 69 73 20 65 78 65 63 | 75 74 65 64 20 77 68 65 | is exec|uted whe|
|00002550| 6e 20 6e 6f 20 65 78 63 | 65 70 74 69 6f 6e 20 6f |n no exc|eption o|
|00002560| 63 63 75 72 73 0d 69 6e | 20 74 68 65 20 5c 76 65 |ccurs.in| the \ve|
|00002570| 72 62 40 74 72 79 40 20 | 63 6c 61 75 73 65 2e 20 |rb@try@ |clause. |
|00002580| 20 45 78 63 65 70 74 69 | 6f 6e 73 20 69 6e 20 74 | Excepti|ons in t|
|00002590| 68 65 20 5c 76 65 72 62 | 40 65 6c 73 65 40 20 63 |he \verb|@else@ c|
|000025a0| 6c 61 75 73 65 20 61 72 | 65 0d 6e 6f 74 20 68 61 |lause ar|e.not ha|
|000025b0| 6e 64 6c 65 64 20 62 79 | 20 74 68 65 20 70 72 65 |ndled by| the pre|
|000025c0| 63 65 64 69 6e 67 20 5c | 76 65 72 62 40 65 78 63 |ceding \|verb@exc|
|000025d0| 65 70 74 40 20 63 6c 61 | 75 73 65 73 2e 0d 5c 6b |ept@ cla|uses..\k|
|000025e0| 77 69 6e 64 65 78 7b 65 | 6c 73 65 7d 0d 0d 54 68 |windex{e|lse}..Th|
|000025f0| 65 20 5c 76 65 72 62 40 | 74 72 79 2e 2e 2e 66 69 |e \verb@|try...fi|
|00002600| 6e 61 6c 6c 79 40 20 66 | 6f 72 6d 20 73 70 65 63 |nally@ f|orm spec|
|00002610| 69 66 69 65 73 20 61 20 | 60 63 6c 65 61 6e 75 70 |ifies a |`cleanup|
|00002620| 27 20 68 61 6e 64 6c 65 | 72 2e 20 20 54 68 65 0d |' handle|r. The.|
|00002630| 5c 76 65 72 62 40 74 72 | 79 40 20 63 6c 61 75 73 |\verb@tr|y@ claus|
|00002640| 65 20 69 73 20 65 78 65 | 63 75 74 65 64 2e 20 20 |e is exe|cuted. |
|00002650| 57 68 65 6e 20 6e 6f 20 | 65 78 63 65 70 74 69 6f |When no |exceptio|
|00002660| 6e 20 6f 63 63 75 72 73 | 2c 20 74 68 65 0d 5c 76 |n occurs|, the.\v|
|00002670| 65 72 62 40 66 69 6e 61 | 6c 6c 79 40 20 63 6c 61 |erb@fina|lly@ cla|
|00002680| 75 73 65 20 69 73 20 65 | 78 65 63 75 74 65 64 2e |use is e|xecuted.|
|00002690| 20 20 57 68 65 6e 20 61 | 6e 20 65 78 63 65 70 74 | When a|n except|
|000026a0| 69 6f 6e 20 6f 63 63 75 | 72 73 20 69 6e 20 74 68 |ion occu|rs in th|
|000026b0| 65 0d 5c 76 65 72 62 40 | 74 72 79 40 20 63 6c 61 |e.\verb@|try@ cla|
|000026c0| 75 73 65 2c 20 74 68 65 | 20 65 78 63 65 70 74 69 |use, the| excepti|
|000026d0| 6f 6e 20 69 73 20 74 65 | 6d 70 6f 72 61 72 69 6c |on is te|mporaril|
|000026e0| 79 20 73 61 76 65 64 2c | 20 74 68 65 0d 5c 76 65 |y saved,| the.\ve|
|000026f0| 72 62 40 66 69 6e 61 6c | 6c 79 40 20 63 6c 61 75 |rb@final|ly@ clau|
|00002700| 73 65 20 69 73 20 65 78 | 65 63 75 74 65 64 2c 20 |se is ex|ecuted, |
|00002710| 61 6e 64 20 74 68 65 6e | 20 74 68 65 20 73 61 76 |and then| the sav|
|00002720| 65 64 20 65 78 63 65 70 | 74 69 6f 6e 20 69 73 0d |ed excep|tion is.|
|00002730| 72 65 2d 72 61 69 73 65 | 64 2e 20 20 49 66 20 74 |re-raise|d. If t|
|00002740| 68 65 20 5c 76 65 72 62 | 40 66 69 6e 61 6c 6c 79 |he \verb|@finally|
|00002750| 40 20 63 6c 61 75 73 65 | 20 72 61 69 73 65 73 20 |@ clause| raises |
|00002760| 61 6e 6f 74 68 65 72 20 | 65 78 63 65 70 74 69 6f |another |exceptio|
|00002770| 6e 20 6f 72 0d 65 78 65 | 63 75 74 65 73 20 61 20 |n or.exe|cutes a |
|00002780| 5c 76 65 72 62 40 72 65 | 74 75 72 6e 40 2c 20 5c |\verb@re|turn@, \|
|00002790| 76 65 72 62 40 62 72 65 | 61 6b 40 20 6f 72 20 5c |verb@bre|ak@ or \|
|000027a0| 76 65 72 62 40 63 6f 6e | 74 69 6e 75 65 40 20 73 |verb@con|tinue@ s|
|000027b0| 74 61 74 65 6d 65 6e 74 | 2c 0d 74 68 65 20 73 61 |tatement|,.the sa|
|000027c0| 76 65 64 20 65 78 63 65 | 70 74 69 6f 6e 20 69 73 |ved exce|ption is|
|000027d0| 20 6c 6f 73 74 2e 0d 5c | 6b 77 69 6e 64 65 78 7b | lost..\|kwindex{|
|000027e0| 66 69 6e 61 6c 6c 79 7d | 0d 0d 57 68 65 6e 20 61 |finally}|..When a|
|000027f0| 20 5c 76 65 72 62 40 72 | 65 74 75 72 6e 40 20 6f | \verb@r|eturn@ o|
|00002800| 72 20 5c 76 65 72 62 40 | 62 72 65 61 6b 40 20 73 |r \verb@|break@ s|
|00002810| 74 61 74 65 6d 65 6e 74 | 20 69 73 20 65 78 65 63 |tatement| is exec|
|00002820| 75 74 65 64 20 69 6e 20 | 74 68 65 0d 5c 76 65 72 |uted in |the.\ver|
|00002830| 62 40 74 72 79 40 20 73 | 75 69 74 65 20 6f 66 20 |b@try@ s|uite of |
|00002840| 61 20 5c 76 65 72 62 40 | 74 72 79 2e 2e 2e 66 69 |a \verb@|try...fi|
|00002850| 6e 61 6c 6c 79 40 20 73 | 74 61 74 65 6d 65 6e 74 |nally@ s|tatement|
|00002860| 2c 20 74 68 65 0d 5c 76 | 65 72 62 40 66 69 6e 61 |, the.\v|erb@fina|
|00002870| 6c 6c 79 40 20 63 6c 61 | 75 73 65 20 69 73 20 61 |lly@ cla|use is a|
|00002880| 6c 73 6f 20 65 78 65 63 | 75 74 65 64 20 60 6f 6e |lso exec|uted `on|
|00002890| 20 74 68 65 20 77 61 79 | 20 6f 75 74 27 2e 20 20 | the way| out'. |
|000028a0| 41 0d 5c 76 65 72 62 40 | 63 6f 6e 74 69 6e 75 65 |A.\verb@|continue|
|000028b0| 40 20 73 74 61 74 65 6d | 65 6e 74 20 69 73 20 69 |@ statem|ent is i|
|000028c0| 6c 6c 65 67 61 6c 20 69 | 6e 20 74 68 65 20 5c 76 |llegal i|n the \v|
|000028d0| 65 72 62 40 74 72 79 40 | 20 63 6c 61 75 73 65 2e |erb@try@| clause.|
|000028e0| 20 20 28 54 68 65 0d 72 | 65 61 73 6f 6e 20 69 73 | (The.r|eason is|
|000028f0| 20 61 20 70 72 6f 62 6c | 65 6d 20 77 69 74 68 20 | a probl|em with |
|00002900| 74 68 65 20 63 75 72 72 | 65 6e 74 20 69 6d 70 6c |the curr|ent impl|
|00002910| 65 6d 65 6e 74 61 74 69 | 6f 6e 20 2d 2d 2d 20 74 |ementati|on --- t|
|00002920| 68 69 73 0d 72 65 73 74 | 72 69 63 74 69 6f 6e 20 |his.rest|riction |
|00002930| 6d 61 79 20 62 65 20 6c | 69 66 74 65 64 20 69 6e |may be l|ifted in|
|00002940| 20 74 68 65 20 66 75 74 | 75 72 65 29 2e 0d 5c 73 | the fut|ure)..\s|
|00002950| 74 69 6e 64 65 78 7b 72 | 65 74 75 72 6e 7d 0d 5c |tindex{r|eturn}.\|
|00002960| 73 74 69 6e 64 65 78 7b | 62 72 65 61 6b 7d 0d 5c |stindex{|break}.\|
|00002970| 73 74 69 6e 64 65 78 7b | 63 6f 6e 74 69 6e 75 65 |stindex{|continue|
|00002980| 7d 0d 0d 5c 73 65 63 74 | 69 6f 6e 7b 46 75 6e 63 |}..\sect|ion{Func|
|00002990| 74 69 6f 6e 20 64 65 66 | 69 6e 69 74 69 6f 6e 73 |tion def|initions|
|000029a0| 7d 20 5c 6c 61 62 65 6c | 7b 66 75 6e 63 74 69 6f |} \label|{functio|
|000029b0| 6e 7d 0d 5c 69 6e 64 65 | 78 69 69 7b 66 75 6e 63 |n}.\inde|xii{func|
|000029c0| 74 69 6f 6e 7d 7b 64 65 | 66 69 6e 69 74 69 6f 6e |tion}{de|finition|
|000029d0| 7d 0d 0d 41 20 66 75 6e | 63 74 69 6f 6e 20 64 65 |}..A fun|ction de|
|000029e0| 66 69 6e 69 74 69 6f 6e | 20 64 65 66 69 6e 65 73 |finition| defines|
|000029f0| 20 61 20 75 73 65 72 2d | 64 65 66 69 6e 65 64 20 | a user-|defined |
|00002a00| 66 75 6e 63 74 69 6f 6e | 20 6f 62 6a 65 63 74 20 |function| object |
|00002a10| 28 73 65 65 0d 73 65 63 | 74 69 6f 6e 20 5c 72 65 |(see.sec|tion \re|
|00002a20| 66 7b 74 79 70 65 73 7d | 29 3a 0d 5c 6f 62 69 6e |f{types}|):.\obin|
|00002a30| 64 65 78 7b 75 73 65 72 | 2d 64 65 66 69 6e 65 64 |dex{user|-defined|
|00002a40| 20 66 75 6e 63 74 69 6f | 6e 7d 0d 5c 6f 62 69 6e | functio|n}.\obin|
|00002a50| 64 65 78 7b 66 75 6e 63 | 74 69 6f 6e 7d 0d 0d 5c |dex{func|tion}..\|
|00002a60| 62 65 67 69 6e 7b 76 65 | 72 62 61 74 69 6d 7d 0d |begin{ve|rbatim}.|
|00002a70| 66 75 6e 63 64 65 66 3a | 20 20 20 20 20 20 20 20 |funcdef:| |
|00002a80| 22 64 65 66 22 20 66 75 | 6e 63 6e 61 6d 65 20 22 |"def" fu|ncname "|
|00002a90| 28 22 20 5b 70 61 72 61 | 6d 65 74 65 72 5f 6c 69 |(" [para|meter_li|
|00002aa0| 73 74 5d 20 22 29 22 20 | 22 3a 22 20 73 75 69 74 |st] ")" |":" suit|
|00002ab0| 65 0d 70 61 72 61 6d 65 | 74 65 72 5f 6c 69 73 74 |e.parame|ter_list|
|00002ac0| 3a 20 28 64 65 66 70 61 | 72 61 6d 65 74 65 72 20 |: (defpa|rameter |
|00002ad0| 22 2c 22 29 2a 20 28 22 | 2a 22 20 69 64 65 6e 74 |",")* ("|*" ident|
|00002ae0| 69 66 69 65 72 20 7c 20 | 64 65 66 70 61 72 61 6d |ifier | |defparam|
|00002af0| 65 74 65 72 20 5b 22 2c | 22 5d 29 0d 64 65 66 70 |eter [",|"]).defp|
|00002b00| 61 72 61 6d 65 74 65 72 | 3a 20 20 20 70 61 72 61 |arameter|: para|
|00002b10| 6d 65 74 65 72 20 5b 22 | 3d 22 20 63 6f 6e 64 69 |meter ["|=" condi|
|00002b20| 74 69 6f 6e 5d 0d 73 75 | 62 6c 69 73 74 3a 20 20 |tion].su|blist: |
|00002b30| 20 20 20 20 20 20 70 61 | 72 61 6d 65 74 65 72 20 | pa|rameter |
|00002b40| 28 22 2c 22 20 70 61 72 | 61 6d 65 74 65 72 29 2a |("," par|ameter)*|
|00002b50| 20 5b 22 2c 22 5d 0d 70 | 61 72 61 6d 65 74 65 72 | [","].p|arameter|
|00002b60| 3a 20 20 20 20 20 20 69 | 64 65 6e 74 69 66 69 65 |: i|dentifie|
|00002b70| 72 20 7c 20 22 28 22 20 | 73 75 62 6c 69 73 74 20 |r | "(" |sublist |
|00002b80| 22 29 22 0d 66 75 6e 63 | 6e 61 6d 65 3a 20 20 20 |")".func|name: |
|00002b90| 20 20 20 20 69 64 65 6e | 74 69 66 69 65 72 0d 5c | iden|tifier.\|
|00002ba0| 65 6e 64 7b 76 65 72 62 | 61 74 69 6d 7d 0d 0d 41 |end{verb|atim}..A|
|00002bb0| 20 66 75 6e 63 74 69 6f | 6e 20 64 65 66 69 6e 69 | functio|n defini|
|00002bc0| 74 69 6f 6e 20 69 73 20 | 61 6e 20 65 78 65 63 75 |tion is |an execu|
|00002bd0| 74 61 62 6c 65 20 73 74 | 61 74 65 6d 65 6e 74 2e |table st|atement.|
|00002be0| 20 20 49 74 73 20 65 78 | 65 63 75 74 69 6f 6e 20 | Its ex|ecution |
|00002bf0| 62 69 6e 64 73 0d 74 68 | 65 20 66 75 6e 63 74 69 |binds.th|e functi|
|00002c00| 6f 6e 20 6e 61 6d 65 20 | 69 6e 20 74 68 65 20 63 |on name |in the c|
|00002c10| 75 72 72 65 6e 74 20 6c | 6f 63 61 6c 20 6e 61 6d |urrent l|ocal nam|
|00002c20| 65 20 73 70 61 63 65 20 | 74 6f 20 61 20 66 75 6e |e space |to a fun|
|00002c30| 63 74 69 6f 6e 20 6f 62 | 6a 65 63 74 0d 28 61 20 |ction ob|ject.(a |
|00002c40| 77 72 61 70 70 65 72 20 | 61 72 6f 75 6e 64 20 74 |wrapper |around t|
|00002c50| 68 65 20 65 78 65 63 75 | 74 61 62 6c 65 20 63 6f |he execu|table co|
|00002c60| 64 65 20 66 6f 72 20 74 | 68 65 20 66 75 6e 63 74 |de for t|he funct|
|00002c70| 69 6f 6e 29 2e 20 20 54 | 68 69 73 0d 66 75 6e 63 |ion). T|his.func|
|00002c80| 74 69 6f 6e 20 6f 62 6a | 65 63 74 20 63 6f 6e 74 |tion obj|ect cont|
|00002c90| 61 69 6e 73 20 61 20 72 | 65 66 65 72 65 6e 63 65 |ains a r|eference|
|00002ca0| 20 74 6f 20 74 68 65 20 | 63 75 72 72 65 6e 74 20 | to the |current |
|00002cb0| 67 6c 6f 62 61 6c 20 6e | 61 6d 65 20 73 70 61 63 |global n|ame spac|
|00002cc0| 65 0d 61 73 20 74 68 65 | 20 67 6c 6f 62 61 6c 20 |e.as the| global |
|00002cd0| 6e 61 6d 65 20 73 70 61 | 63 65 20 74 6f 20 62 65 |name spa|ce to be|
|00002ce0| 20 75 73 65 64 20 77 68 | 65 6e 20 74 68 65 20 66 | used wh|en the f|
|00002cf0| 75 6e 63 74 69 6f 6e 20 | 69 73 20 63 61 6c 6c 65 |unction |is calle|
|00002d00| 64 2e 0d 5c 69 6e 64 65 | 78 69 69 7b 66 75 6e 63 |d..\inde|xii{func|
|00002d10| 74 69 6f 6e 7d 7b 6e 61 | 6d 65 7d 0d 5c 69 6e 64 |tion}{na|me}.\ind|
|00002d20| 65 78 69 69 7b 6e 61 6d | 65 7d 7b 62 69 6e 64 69 |exii{nam|e}{bindi|
|00002d30| 6e 67 7d 0d 0d 54 68 65 | 20 66 75 6e 63 74 69 6f |ng}..The| functio|
|00002d40| 6e 20 64 65 66 69 6e 69 | 74 69 6f 6e 20 64 6f 65 |n defini|tion doe|
|00002d50| 73 20 6e 6f 74 20 65 78 | 65 63 75 74 65 20 74 68 |s not ex|ecute th|
|00002d60| 65 20 66 75 6e 63 74 69 | 6f 6e 20 62 6f 64 79 3b |e functi|on body;|
|00002d70| 20 74 68 69 73 20 67 65 | 74 73 0d 65 78 65 63 75 | this ge|ts.execu|
|00002d80| 74 65 64 20 6f 6e 6c 79 | 20 77 68 65 6e 20 74 68 |ted only| when th|
|00002d90| 65 20 66 75 6e 63 74 69 | 6f 6e 20 69 73 20 63 61 |e functi|on is ca|
|00002da0| 6c 6c 65 64 2e 0d 0d 57 | 68 65 6e 20 6f 6e 65 20 |lled...W|hen one |
|00002db0| 6f 72 20 6d 6f 72 65 20 | 74 6f 70 2d 6c 65 76 65 |or more |top-leve|
|00002dc0| 6c 20 70 61 72 61 6d 65 | 74 65 72 73 20 68 61 76 |l parame|ters hav|
|00002dd0| 65 20 74 68 65 20 66 6f | 72 6d 20 7b 5c 65 6d 20 |e the fo|rm {\em |
|00002de0| 70 61 72 61 6d 65 74 65 | 72 20 3d 0d 63 6f 6e 64 |paramete|r =.cond|
|00002df0| 69 74 69 6f 6e 7d 2c 20 | 74 68 65 20 66 75 6e 63 |ition}, |the func|
|00002e00| 74 69 6f 6e 20 69 73 20 | 73 61 69 64 20 74 6f 20 |tion is |said to |
|00002e10| 68 61 76 65 20 60 60 64 | 65 66 61 75 6c 74 20 70 |have ``d|efault p|
|00002e20| 61 72 61 6d 65 74 65 72 | 20 76 61 6c 75 65 73 27 |arameter| values'|
|00002e30| 27 2e 0d 44 65 66 61 75 | 6c 74 20 70 61 72 61 6d |'..Defau|lt param|
|00002e40| 65 74 65 72 20 76 61 6c | 75 65 73 20 61 72 65 20 |eter val|ues are |
|00002e50| 65 76 61 6c 75 61 74 65 | 64 20 77 68 65 6e 20 74 |evaluate|d when t|
|00002e60| 68 65 20 66 75 6e 63 74 | 69 6f 6e 20 64 65 66 69 |he funct|ion defi|
|00002e70| 6e 69 74 69 6f 6e 20 69 | 73 0d 65 78 65 63 75 74 |nition i|s.execut|
|00002e80| 65 64 2e 20 20 46 6f 72 | 20 61 20 70 61 72 61 6d |ed. For| a param|
|00002e90| 65 74 65 72 20 77 69 74 | 68 20 61 20 64 65 66 61 |eter wit|h a defa|
|00002ea0| 75 6c 74 20 76 61 6c 75 | 65 2c 20 74 68 65 20 63 |ult valu|e, the c|
|00002eb0| 6f 72 72 65 70 6f 6e 64 | 69 6e 67 0d 61 72 67 75 |orrepond|ing.argu|
|00002ec0| 6d 65 6e 74 20 6d 61 79 | 20 62 65 20 6f 6d 69 74 |ment may| be omit|
|00002ed0| 74 65 64 20 66 72 6f 6d | 20 61 20 63 61 6c 6c 2c |ted from| a call,|
|00002ee0| 20 69 6e 20 77 68 69 63 | 68 20 63 61 73 65 20 74 | in whic|h case t|
|00002ef0| 68 65 20 70 61 72 61 6d | 65 74 65 72 27 73 0d 64 |he param|eter's.d|
|00002f00| 65 66 61 75 6c 74 20 76 | 61 6c 75 65 20 69 73 20 |efault v|alue is |
|00002f10| 73 75 62 73 74 69 74 75 | 74 65 64 2e 20 20 49 66 |substitu|ted. If|
|00002f20| 20 61 20 70 61 72 61 6d | 65 74 65 72 20 68 61 73 | a param|eter has|
|00002f30| 20 61 20 64 65 66 61 75 | 6c 74 20 76 61 6c 75 65 | a defau|lt value|
|00002f40| 2c 20 61 6c 6c 0d 66 6f | 6c 6c 6f 77 69 6e 67 20 |, all.fo|llowing |
|00002f50| 70 61 72 61 6d 65 74 65 | 72 73 20 6d 75 73 74 20 |paramete|rs must |
|00002f60| 61 6c 73 6f 20 68 61 76 | 65 20 61 20 64 65 66 61 |also hav|e a defa|
|00002f70| 75 6c 74 20 76 61 6c 75 | 65 20 2d 2d 2d 20 74 68 |ult valu|e --- th|
|00002f80| 69 73 20 69 73 20 61 0d | 73 79 6e 74 61 63 74 69 |is is a.|syntacti|
|00002f90| 63 20 72 65 73 74 72 69 | 63 74 69 6f 6e 20 74 68 |c restri|ction th|
|00002fa0| 61 74 20 69 73 20 6e 6f | 74 20 65 78 70 72 65 73 |at is no|t expres|
|00002fb0| 73 65 64 20 62 79 20 74 | 68 65 20 67 72 61 6d 6d |sed by t|he gramm|
|00002fc0| 61 72 2e 25 0d 5c 66 6f | 6f 74 6e 6f 74 65 7b 43 |ar.%.\fo|otnote{C|
|00002fd0| 75 72 72 65 6e 74 6c 79 | 20 74 68 69 73 20 69 73 |urrently| this is|
|00002fe0| 20 6e 6f 74 20 63 68 65 | 63 6b 65 64 3b 20 69 6e | not che|cked; in|
|00002ff0| 73 74 65 61 64 2c 0d 5c | 76 65 72 62 40 64 65 66 |stead,.\|verb@def|
|00003000| 20 66 28 61 3d 31 2c 62 | 29 40 20 69 73 20 69 6e | f(a=1,b|)@ is in|
|00003010| 74 65 72 70 72 65 74 65 | 64 20 61 73 20 5c 76 65 |terprete|d as \ve|
|00003020| 72 62 40 64 65 66 20 66 | 28 61 3d 31 2c 62 3d 4e |rb@def f|(a=1,b=N|
|00003030| 6f 6e 65 29 40 2e 7d 0d | 5c 69 6e 64 65 78 69 69 |one)@.}.|\indexii|
|00003040| 69 7b 64 65 66 61 75 6c | 74 7d 7b 70 61 72 61 6d |i{defaul|t}{param|
|00003050| 65 74 65 72 7d 7b 76 61 | 6c 75 65 7d 0d 0d 46 75 |eter}{va|lue}..Fu|
|00003060| 6e 63 74 69 6f 6e 20 63 | 61 6c 6c 20 73 65 6d 61 |nction c|all sema|
|00003070| 6e 74 69 63 73 20 61 72 | 65 20 64 65 73 63 72 69 |ntics ar|e descri|
|00003080| 62 65 64 20 69 6e 20 73 | 65 63 74 69 6f 6e 20 5c |bed in s|ection \|
|00003090| 72 65 66 7b 63 61 6c 6c | 73 7d 2e 20 20 57 68 65 |ref{call|s}. Whe|
|000030a0| 6e 20 61 0d 75 73 65 72 | 2d 64 65 66 69 6e 65 64 |n a.user|-defined|
|000030b0| 20 66 75 6e 63 74 69 6f | 6e 20 69 73 20 63 61 6c | functio|n is cal|
|000030c0| 6c 65 64 2c 20 66 69 72 | 73 74 20 6d 69 73 73 69 |led, fir|st missi|
|000030d0| 6e 67 20 61 72 67 75 6d | 65 6e 74 73 20 66 6f 72 |ng argum|ents for|
|000030e0| 20 77 68 69 63 68 20 61 | 0d 64 65 66 61 75 6c 74 | which a|.default|
|000030f0| 20 76 61 6c 75 65 20 65 | 78 69 73 74 73 20 61 72 | value e|xists ar|
|00003100| 65 20 73 75 70 70 6c 69 | 65 64 3b 20 74 68 65 6e |e suppli|ed; then|
|00003110| 20 74 68 65 20 61 72 67 | 75 6d 65 6e 74 73 20 28 | the arg|uments (|
|00003120| 61 2e 6b 2e 61 2e 20 61 | 63 74 75 61 6c 0d 70 61 |a.k.a. a|ctual.pa|
|00003130| 72 61 6d 65 74 65 72 73 | 29 20 61 72 65 20 62 6f |rameters|) are bo|
|00003140| 75 6e 64 20 74 6f 20 74 | 68 65 20 28 66 6f 72 6d |und to t|he (form|
|00003150| 61 6c 29 20 70 61 72 61 | 6d 65 74 65 72 73 2c 20 |al) para|meters, |
|00003160| 61 73 20 66 6f 6c 6c 6f | 77 73 3a 0d 5c 69 6e 64 |as follo|ws:.\ind|
|00003170| 65 78 69 69 7b 66 75 6e | 63 74 69 6f 6e 7d 7b 63 |exii{fun|ction}{c|
|00003180| 61 6c 6c 7d 0d 5c 69 6e | 64 65 78 69 69 69 7b 75 |all}.\in|dexiii{u|
|00003190| 73 65 72 2d 64 65 66 69 | 6e 65 64 7d 7b 66 75 6e |ser-defi|ned}{fun|
|000031a0| 63 74 69 6f 6e 7d 7b 63 | 61 6c 6c 7d 0d 5c 69 6e |ction}{c|all}.\in|
|000031b0| 64 65 78 7b 70 61 72 61 | 6d 65 74 65 72 7d 0d 5c |dex{para|meter}.\|
|000031c0| 69 6e 64 65 78 7b 61 72 | 67 75 6d 65 6e 74 7d 0d |index{ar|gument}.|
|000031d0| 5c 69 6e 64 65 78 69 69 | 7b 70 61 72 61 6d 65 74 |\indexii|{paramet|
|000031e0| 65 72 7d 7b 66 6f 72 6d | 61 6c 7d 0d 5c 69 6e 64 |er}{form|al}.\ind|
|000031f0| 65 78 69 69 7b 70 61 72 | 61 6d 65 74 65 72 7d 7b |exii{par|ameter}{|
|00003200| 61 63 74 75 61 6c 7d 0d | 0d 5c 62 65 67 69 6e 7b |actual}.|.\begin{|
|00003210| 69 74 65 6d 69 7a 65 7d | 0d 0d 5c 69 74 65 6d 0d |itemize}|..\item.|
|00003220| 49 66 20 74 68 65 72 65 | 20 61 72 65 20 6e 6f 20 |If there| are no |
|00003230| 66 6f 72 6d 61 6c 20 70 | 61 72 61 6d 65 74 65 72 |formal p|arameter|
|00003240| 73 2c 20 74 68 65 72 65 | 20 6d 75 73 74 20 62 65 |s, there| must be|
|00003250| 20 6e 6f 20 61 72 67 75 | 6d 65 6e 74 73 2e 0d 0d | no argu|ments...|
|00003260| 5c 69 74 65 6d 0d 49 66 | 20 74 68 65 20 66 6f 72 |\item.If| the for|
|00003270| 6d 61 6c 20 70 61 72 61 | 6d 65 74 65 72 20 6c 69 |mal para|meter li|
|00003280| 73 74 20 64 6f 65 73 20 | 6e 6f 74 20 65 6e 64 20 |st does |not end |
|00003290| 69 6e 20 61 20 73 74 61 | 72 20 66 6f 6c 6c 6f 77 |in a sta|r follow|
|000032a0| 65 64 20 62 79 20 61 6e | 0d 69 64 65 6e 74 69 66 |ed by an|.identif|
|000032b0| 69 65 72 2c 20 74 68 65 | 72 65 20 6d 75 73 74 20 |ier, the|re must |
|000032c0| 62 65 20 65 78 61 63 74 | 6c 79 20 61 73 20 6d 61 |be exact|ly as ma|
|000032d0| 6e 79 20 61 72 67 75 6d | 65 6e 74 73 20 61 73 20 |ny argum|ents as |
|000032e0| 74 68 65 72 65 20 61 72 | 65 0d 70 61 72 61 6d 65 |there ar|e.parame|
|000032f0| 74 65 72 73 20 69 6e 20 | 74 68 65 20 66 6f 72 6d |ters in |the form|
|00003300| 61 6c 20 70 61 72 61 6d | 65 74 65 72 20 6c 69 73 |al param|eter lis|
|00003310| 74 20 28 61 74 20 74 68 | 65 20 74 6f 70 20 6c 65 |t (at th|e top le|
|00003320| 76 65 6c 29 3b 20 74 68 | 65 0d 61 72 67 75 6d 65 |vel); th|e.argume|
|00003330| 6e 74 73 20 61 72 65 20 | 61 73 73 69 67 6e 65 64 |nts are |assigned|
|00003340| 20 74 6f 20 74 68 65 20 | 66 6f 72 6d 61 6c 20 70 | to the |formal p|
|00003350| 61 72 61 6d 65 74 65 72 | 73 20 6f 6e 65 20 62 79 |arameter|s one by|
|00003360| 20 6f 6e 65 2e 20 20 4e | 6f 74 65 20 74 68 61 74 | one. N|ote that|
|00003370| 0d 74 68 65 20 70 72 65 | 73 65 6e 63 65 20 6f 72 |.the pre|sence or|
|00003380| 20 61 62 73 65 6e 63 65 | 20 6f 66 20 61 20 74 72 | absence| of a tr|
|00003390| 61 69 6c 69 6e 67 20 63 | 6f 6d 6d 61 20 61 74 20 |ailing c|omma at |
|000033a0| 74 68 65 20 74 6f 70 20 | 6c 65 76 65 6c 20 69 6e |the top |level in|
|000033b0| 20 65 69 74 68 65 72 0d | 74 68 65 20 66 6f 72 6d | either.|the form|
|000033c0| 61 6c 20 6f 72 20 74 68 | 65 20 61 63 74 75 61 6c |al or th|e actual|
|000033d0| 20 70 61 72 61 6d 65 74 | 65 72 20 6c 69 73 74 20 | paramet|er list |
|000033e0| 6d 61 6b 65 73 20 6e 6f | 20 64 69 66 66 65 72 65 |makes no| differe|
|000033f0| 6e 63 65 2e 20 20 54 68 | 65 0d 61 73 73 69 67 6e |nce. Th|e.assign|
|00003400| 6d 65 6e 74 20 74 6f 20 | 61 20 66 6f 72 6d 61 6c |ment to |a formal|
|00003410| 20 70 61 72 61 6d 65 74 | 65 72 20 69 73 20 70 65 | paramet|er is pe|
|00003420| 72 66 6f 72 6d 65 64 20 | 61 73 20 69 66 20 74 68 |rformed |as if th|
|00003430| 65 20 70 61 72 61 6d 65 | 74 65 72 0d 6f 63 63 75 |e parame|ter.occu|
|00003440| 72 73 20 6f 6e 20 74 68 | 65 20 6c 65 66 74 20 68 |rs on th|e left h|
|00003450| 61 6e 64 20 73 69 64 65 | 20 6f 66 20 61 6e 20 61 |and side| of an a|
|00003460| 73 73 69 67 6e 6d 65 6e | 74 20 73 74 61 74 65 6d |ssignmen|t statem|
|00003470| 65 6e 74 20 77 68 6f 73 | 65 20 72 69 67 68 74 0d |ent whos|e right.|
|00003480| 68 61 6e 64 20 73 69 64 | 65 27 73 20 76 61 6c 75 |hand sid|e's valu|
|00003490| 65 20 69 73 20 74 68 61 | 74 20 6f 66 20 74 68 65 |e is tha|t of the|
|000034a0| 20 61 72 67 75 6d 65 6e | 74 2e 0d 0d 5c 69 74 65 | argumen|t...\ite|
|000034b0| 6d 0d 49 66 20 74 68 65 | 20 66 6f 72 6d 61 6c 20 |m.If the| formal |
|000034c0| 70 61 72 61 6d 65 74 65 | 72 20 6c 69 73 74 20 65 |paramete|r list e|
|000034d0| 6e 64 73 20 69 6e 20 61 | 20 73 74 61 72 20 66 6f |nds in a| star fo|
|000034e0| 6c 6c 6f 77 65 64 20 62 | 79 20 61 6e 20 69 64 65 |llowed b|y an ide|
|000034f0| 6e 74 69 66 69 65 72 2c | 0d 70 72 65 63 65 64 65 |ntifier,|.precede|
|00003500| 64 20 62 79 20 7a 65 72 | 6f 20 6f 72 20 6d 6f 72 |d by zer|o or mor|
|00003510| 65 20 63 6f 6d 6d 61 2d | 66 6f 6c 6c 6f 77 65 64 |e comma-|followed|
|00003520| 20 70 61 72 61 6d 65 74 | 65 72 73 2c 20 74 68 65 | paramet|ers, the|
|00003530| 72 65 20 6d 75 73 74 20 | 62 65 20 61 74 0d 6c 65 |re must |be at.le|
|00003540| 61 73 74 20 61 73 20 6d | 61 6e 79 20 61 72 67 75 |ast as m|any argu|
|00003550| 6d 65 6e 74 73 20 61 73 | 20 74 68 65 72 65 20 61 |ments as| there a|
|00003560| 72 65 20 70 61 72 61 6d | 65 74 65 72 73 20 70 72 |re param|eters pr|
|00003570| 65 63 65 64 69 6e 67 20 | 74 68 65 20 73 74 61 72 |eceding |the star|
|00003580| 2e 0d 43 61 6c 6c 20 74 | 68 69 73 20 6e 75 6d 62 |..Call t|his numb|
|00003590| 65 72 20 7b 5c 65 6d 20 | 4e 7d 2e 20 20 54 68 65 |er {\em |N}. The|
|000035a0| 20 66 69 72 73 74 20 7b | 5c 65 6d 20 4e 7d 20 61 | first {|\em N} a|
|000035b0| 72 67 75 6d 65 6e 74 73 | 20 61 72 65 20 61 73 73 |rguments| are ass|
|000035c0| 69 67 6e 65 64 20 74 6f | 0d 74 68 65 20 63 6f 72 |igned to|.the cor|
|000035d0| 72 65 73 70 6f 6e 64 69 | 6e 67 20 66 6f 72 6d 61 |respondi|ng forma|
|000035e0| 6c 20 70 61 72 61 6d 65 | 74 65 72 73 20 69 6e 20 |l parame|ters in |
|000035f0| 74 68 65 20 77 61 79 20 | 64 65 73 63 69 62 65 64 |the way |descibed|
|00003600| 20 61 62 6f 76 65 2e 20 | 20 41 0d 74 75 70 6c 65 | above. | A.tuple|
|00003610| 20 63 6f 6e 74 61 69 6e | 69 6e 67 20 74 68 65 20 | contain|ing the |
|00003620| 72 65 6d 61 69 6e 69 6e | 67 20 61 72 67 75 6d 65 |remainin|g argume|
|00003630| 6e 74 73 2c 20 69 66 20 | 61 6e 79 2c 20 69 73 20 |nts, if |any, is |
|00003640| 74 68 65 6e 20 61 73 73 | 69 67 6e 65 64 20 74 6f |then ass|igned to|
|00003650| 0d 74 68 65 20 69 64 65 | 6e 74 69 66 69 65 72 20 |.the ide|ntifier |
|00003660| 66 6f 6c 6c 6f 77 69 6e | 67 20 74 68 65 20 73 74 |followin|g the st|
|00003670| 61 72 2e 20 20 54 68 69 | 73 20 76 61 72 69 61 62 |ar. Thi|s variab|
|00003680| 6c 65 20 77 69 6c 6c 20 | 61 6c 77 61 79 73 20 62 |le will |always b|
|00003690| 65 20 61 0d 74 75 70 6c | 65 3a 20 69 66 20 74 68 |e a.tupl|e: if th|
|000036a0| 65 72 65 20 61 72 65 20 | 6e 6f 20 65 78 74 72 61 |ere are |no extra|
|000036b0| 20 61 72 67 75 6d 65 6e | 74 73 2c 20 69 74 73 20 | argumen|ts, its |
|000036c0| 76 61 6c 75 65 20 69 73 | 20 5c 76 65 72 62 40 28 |value is| \verb@(|
|000036d0| 29 40 2c 20 69 66 0d 74 | 68 65 72 65 20 69 73 20 |)@, if.t|here is |
|000036e0| 6a 75 73 74 20 6f 6e 65 | 20 65 78 74 72 61 20 61 |just one| extra a|
|000036f0| 72 67 75 6d 65 6e 74 2c | 20 69 74 20 69 73 20 61 |rgument,| it is a|
|00003700| 20 73 69 6e 67 6c 65 74 | 6f 6e 20 74 75 70 6c 65 | singlet|on tuple|
|00003710| 2e 0d 5c 69 6e 64 65 78 | 69 69 7b 76 61 72 69 61 |..\index|ii{varia|
|00003720| 62 6c 65 20 6c 65 6e 67 | 74 68 7d 7b 70 61 72 61 |ble leng|th}{para|
|00003730| 6d 65 74 65 72 20 6c 69 | 73 74 7d 0d 0d 5c 65 6e |meter li|st}..\en|
|00003740| 64 7b 69 74 65 6d 69 7a | 65 7d 0d 0d 4e 6f 74 65 |d{itemiz|e}..Note|
|00003750| 20 74 68 61 74 20 74 68 | 65 20 60 76 61 72 69 61 | that th|e `varia|
|00003760| 62 6c 65 20 6c 65 6e 67 | 74 68 20 70 61 72 61 6d |ble leng|th param|
|00003770| 65 74 65 72 20 6c 69 73 | 74 27 20 66 65 61 74 75 |eter lis|t' featu|
|00003780| 72 65 20 6f 6e 6c 79 20 | 77 6f 72 6b 73 20 61 74 |re only |works at|
|00003790| 0d 74 68 65 20 74 6f 70 | 20 6c 65 76 65 6c 20 6f |.the top| level o|
|000037a0| 66 20 74 68 65 20 70 61 | 72 61 6d 65 74 65 72 20 |f the pa|rameter |
|000037b0| 6c 69 73 74 3b 20 69 6e | 64 69 76 69 64 75 61 6c |list; in|dividual|
|000037c0| 20 70 61 72 61 6d 65 74 | 65 72 73 20 75 73 65 20 | paramet|ers use |
|000037d0| 61 20 6d 6f 64 65 6c 0d | 63 6f 72 72 65 73 70 6f |a model.|correspo|
|000037e0| 6e 64 69 6e 67 20 6d 6f | 72 65 20 63 6c 6f 73 65 |nding mo|re close|
|000037f0| 6c 79 20 74 6f 20 74 68 | 61 74 20 6f 66 20 6f 72 |ly to th|at of or|
|00003800| 64 69 6e 61 72 79 20 61 | 73 73 69 67 6e 6d 65 6e |dinary a|ssignmen|
|00003810| 74 2e 20 20 57 68 69 6c | 65 20 74 68 65 0d 6c 61 |t. Whil|e the.la|
|00003820| 74 74 65 72 20 6d 6f 64 | 65 6c 20 69 73 20 67 65 |tter mod|el is ge|
|00003830| 6e 65 72 61 6c 6c 79 20 | 70 72 65 66 65 72 61 62 |nerally |preferab|
|00003840| 6c 65 2c 20 62 65 63 61 | 75 73 65 20 6f 66 20 74 |le, beca|use of t|
|00003850| 68 65 20 67 72 65 61 74 | 65 72 20 74 79 70 65 0d |he great|er type.|
|00003860| 73 61 66 65 74 79 20 69 | 74 20 6f 66 66 65 72 73 |safety i|t offers|
|00003870| 20 28 77 72 6f 6e 67 2d | 73 69 7a 65 64 20 74 75 | (wrong-|sized tu|
|00003880| 70 6c 65 73 20 61 72 65 | 6e 27 74 20 73 69 6c 65 |ples are|n't sile|
|00003890| 6e 74 6c 79 20 6d 69 73 | 74 72 65 61 74 65 64 29 |ntly mis|treated)|
|000038a0| 2c 0d 76 61 72 69 61 62 | 6c 65 20 6c 65 6e 67 74 |,.variab|le lengt|
|000038b0| 68 20 70 61 72 61 6d 65 | 74 65 72 20 6c 69 73 74 |h parame|ter list|
|000038c0| 73 20 61 72 65 20 61 20 | 73 75 66 66 69 63 69 65 |s are a |sufficie|
|000038d0| 6e 74 6c 79 20 61 63 63 | 65 70 74 65 64 20 70 72 |ntly acc|epted pr|
|000038e0| 61 63 74 69 63 65 0d 69 | 6e 20 6d 6f 73 74 20 70 |actice.i|n most p|
|000038f0| 72 6f 67 72 61 6d 6d 69 | 6e 67 20 6c 61 6e 67 75 |rogrammi|ng langu|
|00003900| 61 67 65 73 20 74 68 61 | 74 20 61 20 63 6f 6d 70 |ages tha|t a comp|
|00003910| 72 6f 6d 69 73 65 20 68 | 61 73 20 62 65 65 6e 20 |romise h|as been |
|00003920| 77 6f 72 6b 65 64 20 6f | 75 74 2e 0d 28 41 6e 64 |worked o|ut..(And|
|00003930| 20 61 6e 79 77 61 79 2c | 20 61 73 73 69 67 6e 6d | anyway,| assignm|
|00003940| 65 6e 74 20 68 61 73 20 | 6e 6f 20 65 71 75 69 76 |ent has |no equiv|
|00003950| 61 6c 65 6e 74 20 66 6f | 72 20 65 6d 70 74 79 20 |alent fo|r empty |
|00003960| 61 72 67 75 6d 65 6e 74 | 20 6c 69 73 74 73 2e 29 |argument| lists.)|
|00003970| 0d 0d 49 74 20 69 73 20 | 61 6c 73 6f 20 70 6f 73 |..It is |also pos|
|00003980| 73 69 62 6c 65 20 74 6f | 20 63 72 65 61 74 65 20 |sible to| create |
|00003990| 61 6e 6f 6e 79 6d 6f 75 | 73 20 66 75 6e 63 74 69 |anonymou|s functi|
|000039a0| 6f 6e 73 20 28 66 75 6e | 63 74 69 6f 6e 73 20 6e |ons (fun|ctions n|
|000039b0| 6f 74 20 62 6f 75 6e 64 | 0d 74 6f 20 61 20 6e 61 |ot bound|.to a na|
|000039c0| 6d 65 29 2c 20 66 6f 72 | 20 69 6d 6d 65 64 69 61 |me), for| immedia|
|000039d0| 74 65 20 75 73 65 20 69 | 6e 20 65 78 70 72 65 73 |te use i|n expres|
|000039e0| 73 69 6f 6e 73 2e 20 20 | 54 68 69 73 20 75 73 65 |sions. |This use|
|000039f0| 73 20 6c 61 6d 62 64 61 | 20 66 6f 72 6d 73 2c 0d |s lambda| forms,.|
|00003a00| 64 65 73 63 72 69 62 65 | 64 20 69 6e 20 73 65 63 |describe|d in sec|
|00003a10| 74 69 6f 6e 20 5c 72 65 | 66 7b 6c 61 6d 62 64 61 |tion \re|f{lambda|
|00003a20| 7d 2e 0d 5c 69 6e 64 65 | 78 69 69 7b 6c 61 6d 62 |}..\inde|xii{lamb|
|00003a30| 64 61 7d 7b 66 6f 72 6d | 7d 0d 0d 5c 73 65 63 74 |da}{form|}..\sect|
|00003a40| 69 6f 6e 7b 43 6c 61 73 | 73 20 64 65 66 69 6e 69 |ion{Clas|s defini|
|00003a50| 74 69 6f 6e 73 7d 20 5c | 6c 61 62 65 6c 7b 63 6c |tions} \|label{cl|
|00003a60| 61 73 73 7d 0d 5c 69 6e | 64 65 78 69 69 7b 63 6c |ass}.\in|dexii{cl|
|00003a70| 61 73 73 7d 7b 64 65 66 | 69 6e 69 74 69 6f 6e 7d |ass}{def|inition}|
|00003a80| 0d 0d 41 20 63 6c 61 73 | 73 20 64 65 66 69 6e 69 |..A clas|s defini|
|00003a90| 74 69 6f 6e 20 64 65 66 | 69 6e 65 73 20 61 20 63 |tion def|ines a c|
|00003aa0| 6c 61 73 73 20 6f 62 6a | 65 63 74 20 28 73 65 65 |lass obj|ect (see|
|00003ab0| 20 73 65 63 74 69 6f 6e | 20 5c 72 65 66 7b 74 79 | section| \ref{ty|
|00003ac0| 70 65 73 7d 29 3a 0d 5c | 6f 62 69 6e 64 65 78 7b |pes}):.\|obindex{|
|00003ad0| 63 6c 61 73 73 7d 0d 0d | 5c 62 65 67 69 6e 7b 76 |class}..|\begin{v|
|00003ae0| 65 72 62 61 74 69 6d 7d | 0d 63 6c 61 73 73 64 65 |erbatim}|.classde|
|00003af0| 66 3a 20 20 20 20 20 20 | 20 22 63 6c 61 73 73 22 |f: | "class"|
|00003b00| 20 63 6c 61 73 73 6e 61 | 6d 65 20 5b 69 6e 68 65 | classna|me [inhe|
|00003b10| 72 69 74 61 6e 63 65 5d | 20 22 3a 22 20 73 75 69 |ritance]| ":" sui|
|00003b20| 74 65 0d 69 6e 68 65 72 | 69 74 61 6e 63 65 3a 20 |te.inher|itance: |
|00003b30| 20 20 20 22 28 22 20 5b | 63 6f 6e 64 69 74 69 6f | "(" [|conditio|
|00003b40| 6e 5f 6c 69 73 74 5d 20 | 22 29 22 0d 63 6c 61 73 |n_list] |")".clas|
|00003b50| 73 6e 61 6d 65 3a 20 20 | 20 20 20 20 69 64 65 6e |sname: | iden|
|00003b60| 74 69 66 69 65 72 0d 5c | 65 6e 64 7b 76 65 72 62 |tifier.\|end{verb|
|00003b70| 61 74 69 6d 7d 0d 0d 41 | 20 63 6c 61 73 73 20 64 |atim}..A| class d|
|00003b80| 65 66 69 6e 69 74 69 6f | 6e 20 69 73 20 61 6e 20 |efinitio|n is an |
|00003b90| 65 78 65 63 75 74 61 62 | 6c 65 20 73 74 61 74 65 |executab|le state|
|00003ba0| 6d 65 6e 74 2e 20 20 49 | 74 20 66 69 72 73 74 20 |ment. I|t first |
|00003bb0| 65 76 61 6c 75 61 74 65 | 73 20 74 68 65 0d 69 6e |evaluate|s the.in|
|00003bc0| 68 65 72 69 74 61 6e 63 | 65 20 6c 69 73 74 2c 20 |heritanc|e list, |
|00003bd0| 69 66 20 70 72 65 73 65 | 6e 74 2e 20 20 45 61 63 |if prese|nt. Eac|
|00003be0| 68 20 69 74 65 6d 20 69 | 6e 20 74 68 65 20 69 6e |h item i|n the in|
|00003bf0| 68 65 72 69 74 61 6e 63 | 65 20 6c 69 73 74 0d 73 |heritanc|e list.s|
|00003c00| 68 6f 75 6c 64 20 65 76 | 61 6c 75 61 74 65 20 74 |hould ev|aluate t|
|00003c10| 6f 20 61 20 63 6c 61 73 | 73 20 6f 62 6a 65 63 74 |o a clas|s object|
|00003c20| 2e 20 20 54 68 65 20 63 | 6c 61 73 73 27 73 20 73 |. The c|lass's s|
|00003c30| 75 69 74 65 20 69 73 20 | 74 68 65 6e 20 65 78 65 |uite is |then exe|
|00003c40| 63 75 74 65 64 0d 69 6e | 20 61 20 6e 65 77 20 65 |cuted.in| a new e|
|00003c50| 78 65 63 75 74 69 6f 6e | 20 66 72 61 6d 65 20 28 |xecution| frame (|
|00003c60| 73 65 65 20 73 65 63 74 | 69 6f 6e 20 5c 72 65 66 |see sect|ion \ref|
|00003c70| 7b 65 78 65 63 66 72 61 | 6d 65 73 7d 29 2c 20 75 |{execfra|mes}), u|
|00003c80| 73 69 6e 67 20 61 20 6e | 65 77 6c 79 0d 63 72 65 |sing a n|ewly.cre|
|00003c90| 61 74 65 64 20 6c 6f 63 | 61 6c 20 6e 61 6d 65 20 |ated loc|al name |
|00003ca0| 73 70 61 63 65 20 61 6e | 64 20 74 68 65 20 6f 72 |space an|d the or|
|00003cb0| 69 67 69 6e 61 6c 20 67 | 6c 6f 62 61 6c 20 6e 61 |iginal g|lobal na|
|00003cc0| 6d 65 20 73 70 61 63 65 | 2e 0d 28 55 73 75 61 6c |me space|..(Usual|
|00003cd0| 6c 79 2c 20 74 68 65 20 | 73 75 69 74 65 20 63 6f |ly, the |suite co|
|00003ce0| 6e 74 61 69 6e 73 20 6f | 6e 6c 79 20 66 75 6e 63 |ntains o|nly func|
|00003cf0| 74 69 6f 6e 20 64 65 66 | 69 6e 69 74 69 6f 6e 73 |tion def|initions|
|00003d00| 2e 29 20 20 57 68 65 6e | 20 74 68 65 0d 63 6c 61 |.) When| the.cla|
|00003d10| 73 73 27 73 20 73 75 69 | 74 65 20 66 69 6e 69 73 |ss's sui|te finis|
|00003d20| 68 65 73 20 65 78 65 63 | 75 74 69 6f 6e 2c 20 69 |hes exec|ution, i|
|00003d30| 74 73 20 65 78 65 63 75 | 74 69 6f 6e 20 66 72 61 |ts execu|tion fra|
|00003d40| 6d 65 20 69 73 20 64 69 | 73 63 61 72 64 65 64 20 |me is di|scarded |
|00003d50| 62 75 74 0d 69 74 73 20 | 6c 6f 63 61 6c 20 6e 61 |but.its |local na|
|00003d60| 6d 65 20 73 70 61 63 65 | 20 69 73 20 73 61 76 65 |me space| is save|
|00003d70| 64 2e 20 20 41 20 63 6c | 61 73 73 20 6f 62 6a 65 |d. A cl|ass obje|
|00003d80| 63 74 20 69 73 20 74 68 | 65 6e 20 63 72 65 61 74 |ct is th|en creat|
|00003d90| 65 64 20 75 73 69 6e 67 | 0d 74 68 65 20 69 6e 68 |ed using|.the inh|
|00003da0| 65 72 69 74 61 6e 63 65 | 20 6c 69 73 74 20 66 6f |eritance| list fo|
|00003db0| 72 20 74 68 65 20 62 61 | 73 65 20 63 6c 61 73 73 |r the ba|se class|
|00003dc0| 65 73 20 61 6e 64 20 74 | 68 65 20 73 61 76 65 64 |es and t|he saved|
|00003dd0| 20 6c 6f 63 61 6c 20 6e | 61 6d 65 0d 73 70 61 63 | local n|ame.spac|
|00003de0| 65 20 66 6f 72 20 74 68 | 65 20 61 74 74 72 69 62 |e for th|e attrib|
|00003df0| 75 74 65 20 64 69 63 74 | 69 6f 6e 61 72 79 2e 20 |ute dict|ionary. |
|00003e00| 20 54 68 65 20 63 6c 61 | 73 73 20 6e 61 6d 65 20 | The cla|ss name |
|00003e10| 69 73 20 62 6f 75 6e 64 | 20 74 6f 20 74 68 69 73 |is bound| to this|
|00003e20| 0d 63 6c 61 73 73 20 6f | 62 6a 65 63 74 20 69 6e |.class o|bject in|
|00003e30| 20 74 68 65 20 6f 72 69 | 67 69 6e 61 6c 20 6c 6f | the ori|ginal lo|
|00003e40| 63 61 6c 20 6e 61 6d 65 | 20 73 70 61 63 65 2e 0d |cal name| space..|
|00003e50| 5c 69 6e 64 65 78 7b 69 | 6e 68 65 72 69 74 61 6e |\index{i|nheritan|
|00003e60| 63 65 7d 0d 5c 69 6e 64 | 65 78 69 69 7b 63 6c 61 |ce}.\ind|exii{cla|
|00003e70| 73 73 7d 7b 6e 61 6d 65 | 7d 0d 5c 69 6e 64 65 78 |ss}{name|}.\index|
|00003e80| 69 69 7b 6e 61 6d 65 7d | 7b 62 69 6e 64 69 6e 67 |ii{name}|{binding|
|00003e90| 7d 0d 5c 69 6e 64 65 78 | 69 69 7b 65 78 65 63 75 |}.\index|ii{execu|
|00003ea0| 74 69 6f 6e 7d 7b 66 72 | 61 6d 65 7d 0d |tion}{fr|ame}. |
+--------+-------------------------+-------------------------+--------+--------+